# coding: utf-8
from sqlalchemy import CHAR, Column, DECIMAL, Date, DateTime, Index, JSON, String, Table, Text, text
from sqlalchemy.dialects.mysql import BIGINT, BIT, INTEGER, SMALLINT, TINYINT, VARCHAR
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class Act(Base):
    __tablename__ = 'act'
    __table_args__ = (
        Index('fx_index', 'name', 'details'),
    )

    id = Column(INTEGER(11), primary_key=True)
    name = Column(String(32), comment='活动名称')
    start_time = Column(INTEGER(11), comment='活动开始时间')
    end_time = Column(INTEGER(11), comment='活动结束时间')
    create_time = Column(INTEGER(11), comment='创建时间')
    details = Column(Text, comment='活动详情描述（富文本）')
    cover = Column(String(255), comment='活动封面')
    cover_mobile = Column(String(255), comment='活动封面-移动端')
    mission_id = Column(BIGINT(20), comment='关联 任务id ')
    state = Column(TINYINT(4), comment='状态 状态 -1审核驳回，0-新建 1-启用，2，下架，3提审, 8异步等待处理中，9 异步处理失败')
    update_time = Column(INTEGER(11), comment='更新时间')
    type = Column(TINYINT(4), server_default=text("'1'"), comment='活动类型  1-常规活动 2-临时活动 3-预告活动 4-版权收益活动 5-众投活动')
    special_cover = Column(String(255), comment='活动专题页封面')
    special_cover_mobile = Column(String(255), comment='活动专题页封面-移动端')
    sort = Column(INTEGER(11), comment='排序（数字越大越靠前）')
    is_verify = Column(TINYINT(4), server_default=text("'0'"), comment='是否开启验证（0-不开启 1-开启）')
    is_enroll = Column(TINYINT(4), server_default=text("'0'"), comment='是否开启报名（0-不开启 1-开启）')
    enroll_img = Column(String(255), comment='报名详情页')
    user_id = Column(BIGINT(20), nullable=False, server_default=text("'0'"), comment='用户uid')


class ActCheck(Base):
    __tablename__ = 'act_check'

    id = Column(BIGINT(20), primary_key=True)
    create_time = Column(DateTime, nullable=False, comment='审核时间')
    operation_id = Column(String(40), nullable=False, comment='审核人id')
    reason = Column(String(500), nullable=False, server_default=text("''"), comment='审核原因，主要记录审核不通过的情况')
    status = Column(TINYINT(1), nullable=False, comment='1 通过 2 驳回')
    act_collection_nft_id = Column(INTEGER(11), nullable=False, comment='关联的act_collection_nft的id')
    act_id = Column(INTEGER(11), nullable=False, comment='act_id')
    mq_status = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='任务处理状态：0 不需要异步处理 1 默认未处理 2 已处理 3 处理失败')
    mq_reason = Column(String(200), nullable=False, server_default=text("''"), comment='处理失败原因')


class ActCollectionNft(Base):
    __tablename__ = 'act_collection_nft'
    __table_args__ = {'comment': '活动-收藏品NFT关联表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    act_id = Column(BIGINT(20), index=True, comment='活动ID')
    collection_nft_id = Column(BIGINT(20), index=True, comment='收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), index=True, comment='收藏品NFT类型ID')
    type = Column(TINYINT(4), comment='玩法类型，1-即开盲盒，2-明盒 3-优先购买权 4-空投 5-自开盲盒 6-众投')
    price = Column(BIGINT(20), comment='单价（单位：分）')
    total_stocks = Column(INTEGER(11), comment='当前活动库存总数量')
    sold_num = Column(INTEGER(11), comment='当前活动售出总数量')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='修改时间')
    version = Column(INTEGER(11), comment='乐观锁')
    restricted_count = Column(BIGINT(20), server_default=text("'-1'"), comment='单次限购数量')
    sort = Column(INTEGER(11), comment='排序（数字越小越靠前）')
    is_show = Column(TINYINT(4), comment='是否展示 0-不展示 1-展示')
    rate = Column(BIGINT(20), comment='概率（盲盒玩法下必填）')
    series_name = Column(String(500), comment='系列名称')
    available_stocks = Column(INTEGER(11), comment='当前活动实际可售库存')
    available_restricted_count = Column(INTEGER(11), comment='实际单次限购数量')
    status = Column(TINYINT(1), server_default=text("'0'"), comment='0 默认未审核 1已审核  主要针对客户端创建')


class AdminAccessLog(Base):
    __tablename__ = 'admin_access_log'
    __table_args__ = {'comment': '后台访问日志'}

    id = Column(BIGINT(20), primary_key=True)
    method = Column(String(30), nullable=False)
    url = Column(String(250), nullable=False)
    request_message = Column(Text)
    response_message = Column(Text)
    ip = Column(String(64), nullable=False)
    op_user_id = Column(BIGINT(20), nullable=False)
    op_user_name = Column(String(100), nullable=False)
    latency_time = Column(String(100))
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    user_agent = Column(String(500))


class AdminMenu(Base):
    __tablename__ = 'admin_menu'
    __table_args__ = {'comment': '后台菜单表'}

    id = Column(INTEGER(10), primary_key=True)
    name = Column(String(90), comment='菜单名称')
    icon = Column(String(150), comment='菜单icon')
    url = Column(String(450), comment='前台路由url')
    pid = Column(INTEGER(10), comment='父节点id，默认为0')
    type = Column(TINYINT(4), comment='类型 1-模块 2-导航 3-菜单 4-节点')
    status = Column(TINYINT(1), comment='是否显示 1-显示 2-不显示')
    note = Column(String(765), comment='菜单备注')
    sort = Column(SMALLINT(5), comment='排序')
    create_time = Column(INTEGER(10), comment='创建时间')
    update_time = Column(INTEGER(10), comment='更新时间')
    back_url = Column(String(450), comment='后台url')


class AdminRole(Base):
    __tablename__ = 'admin_role'
    __table_args__ = {'comment': '后台角色权限表'}

    id = Column(BIGINT(20), primary_key=True)
    role_name = Column(String(450), comment='角色名称')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    menu_id = Column(Text, comment='菜单id，半角逗号分割')
    sort = Column(TINYINT(4), comment='排序')
    half_option = Column(Text, comment='半选权限id 以逗号分隔')


class AdminUser(Base):
    __tablename__ = 'admin_user'
    __table_args__ = {'comment': '后台管理员用户表'}

    user_id = Column(BIGINT(20), primary_key=True)
    account = Column(String(100), nullable=False, comment='账号名称')
    name = Column(String(100), nullable=False, server_default=text("''"))
    password = Column(String(250), comment='密码')
    role_id = Column(String(250), nullable=False, server_default=text("''"), comment='多个角色逗号分割')
    fei_shu_id = Column(String(250), nullable=False, server_default=text("''"))
    salt = Column(String(50), server_default=text("''"))
    status = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='0=正常 1=禁用')
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    update_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    is_first_login = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='0=否 1=是')


class AppChannel(Base):
    __tablename__ = 'app_channel'
    __table_args__ = {'comment': 'APP渠道'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    channel_name = Column(String(100), comment='渠道名称')
    channel_code = Column(String(100), comment='渠道码')
    channel_type = Column(TINYINT(2), server_default=text("'1'"), comment='渠道类型 （1:应用市场 2:推广渠道）')
    status = Column(TINYINT(1), server_default=text("'0'"), comment='状态  0：停用 1：启用')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class AppVersion(Base):
    __tablename__ = 'app_version'

    id = Column(INTEGER(11), primary_key=True)
    platform_id = Column(TINYINT(1), nullable=False, server_default=text("'0'"), comment='平台 1-android 2-ios')
    channel_id = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='渠道号 1-官方 2-appStore，配置文件自定义')
    is_force = Column(TINYINT(1), nullable=False, server_default=text("'0'"), comment='是否强更 0-否 1-是')
    download_url = Column(String(255), nullable=False, server_default=text("''"), comment='下载url，安卓：apk iOS：应用页面url')
    version_code = Column(INTEGER(11), nullable=False, comment='版本号，例如：10')
    version_name = Column(String(32), nullable=False, server_default=text("''"), comment='版本名，例如：1.0.0')
    describe = Column(Text, nullable=False, comment='版本描述')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')


class Area(Base):
    __tablename__ = 'area'
    __table_args__ = {'comment': '行政区划'}

    area_id = Column(BIGINT(20), primary_key=True)
    area_name = Column(String(50))
    parent_id = Column(BIGINT(20), index=True)
    level = Column(INTEGER(1))


class Banner(Base):
    __tablename__ = 'banner'
    __table_args__ = {'comment': 'banner图管理表'}

    id = Column(INTEGER(11), primary_key=True)
    title = Column(String(64), server_default=text("''"), comment='标题')
    link_url = Column(String(256), server_default=text("''"), comment='跳转链接')
    create_time = Column(INTEGER(11), server_default=text("'0'"), comment='创建时间')
    update_time = Column(INTEGER(11), server_default=text("'0'"), comment='更新时间')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='状态 0-禁用，1-启用')
    sort = Column(TINYINT(4), server_default=text("'0'"), comment='排序，数字越大越靠前')
    bg_color = Column(CHAR(8), server_default=text("''"), comment='背景颜色 0x-16进制')
    jump_type = Column(TINYINT(4), server_default=text("'1'"), comment='跳转类型 0-不跳转 1-h5 2-app内部页面')
    image = Column(String(512), server_default=text("''"), comment='图片链接')
    position_id = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='位置 1-pc版首页 2-app版首页')


class BlockchainInfo(Base):
    __tablename__ = 'blockchain_info'
    __table_args__ = {'comment': '区块链信息'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    chain_name = Column(String(100), comment='区块链链名称')
    chain_id = Column(BIGINT(20), comment='链ID')
    rpc_urls = Column(String(900), comment='RPC URL（多个地址逗号隔开）')
    contract = Column(String(100), comment='合约地址')
    _from = Column('from', String(100), comment='公司账号地址')
    key = Column(Text, comment='合约账号私钥（加密存储）')
    owner = Column(String(255), comment='合约账号')
    signer = Column(String(900), comment='签名者账号集合(多个账号逗号隔开)')
    update_time = Column(BIGINT(20), comment='更新时间')
    create_time = Column(BIGINT(20), comment='创建时间')
    state = Column(TINYINT(4), comment='状态（0-禁用 1-启用）')
    contract_name = Column(String(250), comment='合约名称')
    contract_standard = Column(TINYINT(1), comment='合约标准（1:ERC721 ； 2:ERC1155）')
    signer_keys = Column(Text, comment='签名者账户私钥（加密存储，多个私钥逗号隔开，与签名者账户一一对应）')


class CollectionNft(Base):
    __tablename__ = 'collection_nft'
    __table_args__ = {'comment': '收藏品NFT表'}

    id = Column(INTEGER(11), primary_key=True)
    mint_amount = Column(INTEGER(11), comment='nft铸造总量')
    like_count = Column(INTEGER(11), comment='点赞数')
    collection_count = Column(INTEGER(11), comment='收藏数')
    issue_date = Column(Date, comment='发行日期')
    create_time = Column(INTEGER(32), comment='创建时间')
    update_time = Column(INTEGER(32), comment='更新时间')
    topic_number = Column(String(100), comment='主题编号')
    cover = Column(String(255), comment='封面')
    cover_mobile = Column(String(255), comment='NFT封面-移动端')
    starting_token_id = Column(INTEGER(11), comment='NFT铸造TokenId起始值')
    type = Column(TINYINT(4), server_default=text("'0'"), comment='类型 0-普通藏品 1-版权收益藏品')
    desc = Column(Text, comment='NFT系列简介')
    name = Column(String(255), comment='系列名称')
    issue_user_id = Column(BIGINT(20), comment='发行方用户 ID')
    is_blind_box = Column(TINYINT(4), comment='是否是盲盒 0-否 1-是')
    detail_drawing = Column(String(500), comment='详情图')
    detail_drawing_mobile = Column(String(500), comment='详情图-移动端')
    video = Column(String(500), comment='详情页-视频')
    nft_basic_id = Column(BIGINT(20), comment='收藏品NFT基础信息ID')
    is_ration = Column(TINYINT(4), server_default=text("'1'"), comment='是否定量 0-不确定数量 1-确定数量 (盲盒下有效，如果定量则该NFT下每个类型最终数量只有一个；如果不定量则根据概率决定每个类型的最终数量)')
    special_cover = Column(String(500), comment='系列专题封面')
    special_cover_mobile = Column(String(500), comment='系列专题封面-移动端')
    music_id = Column(BIGINT(20), comment='版权收益音乐ID（音频类NFT可绑）')
    generate_type = Column(TINYINT(4), server_default=text("'1'"), comment='tokenId生成规则（1-递增，2-随机）')
    user_id = Column(BIGINT(20), nullable=False, server_default=text("'0'"), comment='用户uid,不为空则为用户创建')


class CollectionNftAirdrop(Base):
    __tablename__ = 'collection_nft_airdrop'
    __table_args__ = {'comment': '收藏品NFT空投记录'}

    id = Column(BIGINT(20), primary_key=True, comment='ID')
    collection_nft_id = Column(BIGINT(20), comment='收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), comment='收藏品NFT 类型ID')
    type = Column(TINYINT(4), comment='空投类型（1-明盒 2-盲盒）')
    state = Column(TINYINT(4), comment='状态（0-未空投 1-已空投）')
    desc = Column(String(500), comment='说明')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    name_list_file = Column(String(500), comment='空投名单文件')
    total = Column(BIGINT(20), comment='已空投总数')
    name_list_info = Column(JSON, comment='空投名单信息')
    stock_id = Column(BIGINT(20), comment='库存ID')


class CollectionNftAuctionBid(Base):
    __tablename__ = 'collection_nft_auction_bid'
    __table_args__ = {'comment': '收藏品nft竞拍报价表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户user_id')
    bid_price = Column(BIGINT(11), comment='报价，单位为分')
    state = Column(TINYINT(11), comment='状态 1-已报价 2-已退款')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    collection_nft_id = Column(INTEGER(11), comment='收藏品nft_id')


class CollectionNftBasic(Base):
    __tablename__ = 'collection_nft_basic'
    __table_args__ = {'comment': '收藏品NFT组合信息表（用户将多期发售的同一类NFT组合到一起）'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    name = Column(String(255), comment='名称')
    desc = Column(Text, comment='专题简介')
    special_cover = Column(String(500), comment='专题封面')
    special_cover_mobile = Column(String(500), comment='专题封面-移动端')
    create_time = Column(INTEGER(32), comment='创建时间')
    update_time = Column(INTEGER(32), comment='更新时间')


t_collection_nft_collect_record = Table(
    'collection_nft_collect_record', metadata,
    Column('id', INTEGER(11)),
    Column('user_id', INTEGER(11), comment='用户user_id'),
    Column('collection_nft_id', INTEGER(11), comment='收藏品nft_id'),
    Column('create_time', INTEGER(11), comment='创建时间'),
    comment='收藏品nft收藏记录表'
)


class CollectionNftEarnDatum(Base):
    __tablename__ = 'collection_nft_earn_data'

    id = Column(INTEGER(11), primary_key=True)
    collection_nft_id = Column(INTEGER(11), nullable=False, comment='收藏品nft_id')
    type = Column(TINYINT(1), nullable=False, comment='类型 1-歌曲播放指数 2-歌曲月播放量 3-收益结算信息')
    stat_day = Column(CHAR(11), nullable=False, comment='统计日期')
    publish_time = Column(INTEGER(11), nullable=False, comment='数据发布时间')
    detail_url = Column(String(200), server_default=text("''"), comment='详情url')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    update_time = Column(INTEGER(11), server_default=text("'0'"), comment='更新时间')


class CollectionNftLog(Base):
    __tablename__ = 'collection_nft_log'
    __table_args__ = {'comment': '收藏品NFT流转记录'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    collection_nft_id = Column(BIGINT(20), comment='收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), comment='收藏品NFT类型ID')
    opt = Column(TINYINT(4), comment='流转方向（1-增加 2-减少）')
    create_time = Column(BIGINT(20), comment='时间')
    _from = Column('from', BIGINT(20), comment='操作用户ID')
    to = Column(BIGINT(20), comment='目标用户ID')
    remark = Column(String(255), comment='备注')
    biz_type = Column(TINYINT(4), comment='业务类型（1-铸造 2-空投 3-转赠 4-卖出 5-取消卖出  6-买入 7-提现 8-销毁）')
    user_nft_id = Column(BIGINT(20), comment='用户持有ID')
    nft_name = Column(String(250), comment='冗余的收藏品NFT名称')
    nft_type_name = Column(String(250), comment='冗余的收藏NFT类型名称')


class CollectionNftMarketOffer(Base):
    __tablename__ = 'collection_nft_market_offer'
    __table_args__ = {'comment': '收藏品NFT寄售记录表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    user_id = Column(BIGINT(20), comment='寄售用户ID')
    collection_nft_id = Column(BIGINT(20), comment='收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), comment='收藏品NFT类型ID')
    user_nft_id = Column(BIGINT(20), comment='用户持有ID')
    price = Column(INTEGER(32), comment='报价（单位：分）')
    end_time = Column(INTEGER(32), comment='截止时间（-1为不限制）')
    create_time = Column(INTEGER(32), comment='寄售时间')
    state = Column(TINYINT(4), server_default=text("'1'"), comment='状态（1-寄售中 2-已取消 3-已成交）')
    update_time = Column(INTEGER(32), comment='更新时间')
    version = Column(INTEGER(11), comment='乐观锁')
    royalties = Column(INTEGER(32), comment='版税（单位：分）')
    service_charge = Column(INTEGER(32), comment='手续费（单位：分）')


class CollectionNftMarketOrder(Base):
    __tablename__ = 'collection_nft_market_order'
    __table_args__ = {'comment': '收藏品NFT成交记录表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    order_no = Column(String(32), comment='成交订单号')
    seller_id = Column(BIGINT(20), comment='卖方用户ID')
    buyer_id = Column(BIGINT(20), comment='买方用户ID')
    offer_id = Column(BIGINT(20), comment='寄售记录ID')
    price = Column(INTEGER(32), comment='成交价（单位：分）')
    third_order_no = Column(String(100), comment='第三方订单号')
    pay_type = Column(TINYINT(4), comment='支付方式')
    collection_nft_id = Column(BIGINT(20), comment='冗余的收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), comment='冗余的收藏品NFT类型ID')
    token_id = Column(INTEGER(32), comment='冗余的收藏品token_id')
    create_time = Column(INTEGER(32), comment='成交时间')
    update_time = Column(INTEGER(32), comment='更新时间')
    version = Column(INTEGER(11), comment='乐观锁')


class CollectionNftOrder(Base):
    __tablename__ = 'collection_nft_order'
    __table_args__ = {'comment': '收藏品nft订单表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), server_default=text("'0'"), comment='用户user_id')
    unit_price = Column(INTEGER(11), server_default=text("'0'"), comment='单价')
    count = Column(INTEGER(11), server_default=text("'0'"), comment='数量')
    total_amount = Column(INTEGER(11), server_default=text("'0'"), comment='总金额')
    order_no = Column(String(32), unique=True, comment='订单号')
    state = Column(TINYINT(1), server_default=text("'0'"), comment='状态 0-未付款 1-已完成 2-已取消 3-退款中 4-已退款')
    order_type = Column(TINYINT(1), server_default=text("'0'"), comment='订单类型 1-即开盲盒 2-明盒 3-自开盲盒 4-众投 5-客户自己发布藏品，虚拟订单，为了兼容用户持有藏品的设计')
    collection_nft_id = Column(INTEGER(11), server_default=text("'0'"), comment='收藏品nft_id')
    create_time = Column(INTEGER(11), server_default=text("'0'"), comment='创建时间')
    update_time = Column(INTEGER(11), server_default=text("'0'"), comment='更新时间')
    third_order_no = Column(String(64), comment='第三方订单号')
    pay_type = Column(TINYINT(1), server_default=text("'0'"), comment='支付类型 1-支付宝 2-微信')
    version = Column(BIGINT(22), nullable=False, server_default=text("'0'"), comment='乐观锁')
    history_order_no = Column(String(512), server_default=text("''"), comment='历史订单号，","分隔')
    act_id = Column(BIGINT(22), comment='活动ID')
    collection_nft_type_id = Column(INTEGER(11), comment='收藏品NFT类型ID')
    quick_pay_ext = Column(Text, comment='快捷支付字段')


t_collection_nft_series_issue_count = Table(
    'collection_nft_series_issue_count', metadata,
    Column('collection_nft_id', INTEGER(11)),
    Column('cnt', DECIMAL(32, 0))
)


class CollectionNftTask(Base):
    __tablename__ = 'collection_nft_task'
    __table_args__ = {'comment': '收藏品NFT任务'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    collection_nft_id = Column(BIGINT(20), index=True, comment='收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), index=True, comment='收藏品NFT类型ID')
    opt = Column(TINYINT(4), comment='操作类型（1-铸造，2-转账，3-销毁）')
    interval = Column(INTEGER(11), comment='周期/秒')
    state = Column(TINYINT(4), comment='状态（0-停止，1-启动）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    task_name = Column(String(100), comment='任务名称')


class CollectionNftTaskLog(Base):
    __tablename__ = 'collection_nft_task_log'
    __table_args__ = {'comment': '收藏品NFT任务执行日志'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    task_id = Column(BIGINT(20), index=True, comment='任务ID')
    state = Column(TINYINT(4), comment='执行状态（0-失败，1-成功）')
    remark = Column(Text, comment='备注信息')
    create_time = Column(BIGINT(20), comment='执行时间')


class CollectionNftType(Base):
    __tablename__ = 'collection_nft_type'
    __table_args__ = {'comment': '收藏品nft类型表'}

    id = Column(INTEGER(11), primary_key=True)
    collection_nft_id = Column(INTEGER(11), index=True, comment='收藏品系列ID')
    name = Column(String(32), comment='nft类型名称')
    create_time = Column(INTEGER(11), comment='创建时间')
    mint_amount = Column(INTEGER(11), comment='铸造数量')
    cover = Column(String(128), comment='封面')
    audio = Column(Text, comment='音频')
    level = Column(TINYINT(1), comment='稀有度ID')
    rate = Column(INTEGER(11), comment='概率 1%=100')
    desc = Column(Text, comment='描述')
    cover_mobile = Column(String(255), comment='封面-移动端')
    metadata_ = Column('metadata', Text, comment='元数据')
    works_id = Column(BIGINT(20), comment='关联作品ID')
    type = Column(TINYINT(4), comment='类型 1-图片 2-音频')
    state = Column(TINYINT(4), server_default=text("'1'"), comment='状态 0-禁用 1-启用')
    extend = Column(Text, comment='拓展属性')
    user_id = Column(BIGINT(20), nullable=False, server_default=text("'0'"), comment='用户uid')
    desc_picture = Column(String(255), nullable=False, server_default=text("''"), comment='描述图片')
    nft_content = Column(String(255), nullable=False, server_default=text("''"), comment=' nft内容，可以是图片，视频，音乐')
    royal_type = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='活动类型 1-常规活动 , 4-版权收益活动')
    income_time = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='nft收益时间')
    residual_quantity = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='剩余数量')


class Config(Base):
    __tablename__ = 'config'
    __table_args__ = (
        Index('config_UN', 'env', 'key', unique=True),
        {'comment': '配置中心表'}
    )

    id = Column(BIGINT(20), primary_key=True, comment='ID')
    env = Column(String(100), comment='环境（Local，Test，Prod）')
    key = Column(String(100), comment='配置Key')
    value = Column(Text, comment='配置Value')
    value_type = Column(TINYINT(4), comment='配置Value类型（1-STRING 2-NUMBER 3-JSON 4-XML 5-日期 6-YAML 7-TOML）')
    desc = Column(String(250), comment='配置描述')
    status = Column(TINYINT(4), server_default=text("'0'"), comment='状态（0-禁用 1-启用）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    is_private = Column(TINYINT(4), server_default=text("'0'"), comment='是否私有（0-否 1-是）')


class ConfigGlobal(Base):
    __tablename__ = 'config_global'

    id = Column(INTEGER(11), primary_key=True)
    name = Column(String(32), nullable=False, comment='配置名')
    value = Column(Text, nullable=False, comment='配置值')
    field_type = Column(INTEGER(11), nullable=False, comment='值类型 1-int 2-string 3支付方式配置')
    example = Column(Text, nullable=False, comment='举例')
    state = Column(TINYINT(1), server_default=text("'0'"), comment='是否启用 0-否 1-是')
    remark = Column(String(32), comment='备注')
    type = Column(INTEGER(11), comment='1-支付配置')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')


class ConfigPayType(Base):
    __tablename__ = 'config_pay_type'

    id = Column(INTEGER(11), primary_key=True)
    pay_type_id = Column(INTEGER(11), unique=True, comment='支付方式id')
    name = Column(String(32), comment='名称')
    platform = Column(String(32), comment='支持的平台，逗号分割 PC、android、ios')
    total_amount = Column(BIGINT(22), server_default=text("'0'"), comment='支付总金额，单位为分')
    today_amount = Column(BIGINT(22), server_default=text("'0'"), comment='今日支付总金额，单位为分')
    total_times = Column(BIGINT(22), server_default=text("'0'"), comment='支付总次数')
    today_times = Column(BIGINT(22), server_default=text("'0'"), comment='今日支付总次数')
    create_time = Column(INTEGER(11), server_default=text("'0'"), comment='创建时间')
    update_time = Column(INTEGER(11), server_default=text("'0'"), comment='更新时间')
    biz_id = Column(String(32), comment='支持的业务类型，逗号分割 1-充值 2-购买盲盒 3-购买版权收益')
    daily_times_limit = Column(INTEGER(11), server_default=text("'0'"), comment='每日限制总订单次数')
    daily_total_amount_limit = Column(BIGINT(22), server_default=text("'0'"), comment='每日限制总金额')
    once_total_amount_limit = Column(BIGINT(22), server_default=text("'0'"), comment='每次充值最大金额限制')
    state = Column(TINYINT(1), server_default=text("'1'"), comment='是否有效 0-否 1-是')
    icon_web = Column(String(512), comment='pc版icon')
    icon_h5 = Column(String(512), comment='移动版、h5版icon')
    minute5_times_limit = Column(INTEGER(11), comment='五分钟次数限制')


t_config_tab = Table(
    'config_tab', metadata,
    Column('id', INTEGER(11), nullable=False, index=True),
    Column('type', INTEGER(11), nullable=False, comment='类型'),
    Column('name', String(32), comment='名称'),
    Column('app_link_url', String(666)),
    Column('h5_link_url', String(512), comment='h5端跳转连接'),
    Column('sort', INTEGER(11), comment='排序，数字越大越靠后'),
    Column('create_time', INTEGER(11), comment='创建时间'),
    Column('update_time', INTEGER(11), comment='更新时间'),
    comment='首页tab配置'
)


class CopyrightOwner(Base):
    __tablename__ = 'copyright_owner'
    __table_args__ = {'comment': '版权方信息'}

    id = Column(BIGINT(11), primary_key=True, comment='主键')
    name = Column(String(255), comment='名称')
    introduce = Column(Text, comment='简介')
    introduction_diagram = Column(String(255), comment='简介图')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    social_account = Column(JSON, comment='社交账号信息')
    user_id = Column(BIGINT(20), comment='关联的用户ID')
    head_portrait = Column(String(255), comment='头像')
    phone = Column(String(11), comment='联系人手机号')


class CrowdFundingConfig(Base):
    __tablename__ = 'crowd_funding_config'
    __table_args__ = {'comment': '众投项目配置表'}

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    title = Column(String(500), index=True, comment='项目标题')
    collection_nft_type = Column(INTEGER(11), comment='藏品类型（1-版权收益类 2-普通藏品类）')
    collection_nft_id = Column(BIGINT(20), nullable=False, comment='收藏品NFT ID')
    target_amount = Column(INTEGER(11), comment='目标金额（单位/分）')
    final_amount = Column(INTEGER(11), server_default=text("'0'"), comment='最终众投金额')
    start_time = Column(INTEGER(11), nullable=False, comment='开始时间')
    end_time = Column(INTEGER(11), nullable=False, comment='结束时间')
    introduce_pic = Column(String(500), comment='众投介绍图')
    community_pic = Column(String(500), comment='社群图')
    launch_user_id = Column(BIGINT(20), index=True, comment='发起人用户ID')
    act_id = Column(BIGINT(20), comment='活动ID')
    look_good_num = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='看好人数')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='状态（0-准备中 1-待审核 2-审核通过 3-审核驳回）')
    is_processed = Column(INTEGER(11), server_default=text("'0'"), comment='是否已处理（0-否 1-是）')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')


class CrowdFundingReward(Base):
    __tablename__ = 'crowd_funding_reward'
    __table_args__ = {'comment': '众投回报配置表'}

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    crowd_funding_id = Column(BIGINT(20), nullable=False, index=True, comment='众投项目ID')
    collection_nft_id = Column(BIGINT(20), nullable=False, index=True, comment='藏品ID')
    collection_nft_type_id = Column(INTEGER(11), nullable=False, comment='收藏品NFT类型ID')
    title = Column(String(500), comment='标题')
    price = Column(BIGINT(20), comment='回报档金额（单位/分）')
    equity_desc = Column(Text, comment='回报权益描述')
    is_purchase_limit = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否限购（0-否 1-是）')
    total_purchase_limit = Column(INTEGER(11), server_default=text("'-1'"), comment='限购总量/库存(-1不限数量)')
    reward_grant_time = Column(INTEGER(11), comment='回报发放时间')
    grant_type = Column(TINYINT(4), comment='回报发放方式（1-虚拟回报 2-实物邮寄 3-虚拟回报+实物邮寄）')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')


class DailyActiveUser(Base):
    __tablename__ = 'daily_active_user'
    __table_args__ = {'comment': '日活表'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True)
    ip = Column(String(50), nullable=False)
    platform = Column(String(50), nullable=False)
    channel = Column(String(30), nullable=False)
    version_name = Column(String(30), nullable=False)
    date = Column(Date, nullable=False, index=True)
    active_count = Column(INTEGER(11), nullable=False, comment='当天活跃次数')
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    update_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))


class Dictionary(Base):
    __tablename__ = 'dictionary'
    __table_args__ = {'comment': '字典表'}

    id = Column(INTEGER(11), primary_key=True)
    parent_number = Column(INTEGER(11), comment='父级字典编号')
    parent_value = Column(String(50), comment='父级字典值')
    is_parent = Column(BIT(1), comment='是否父级字典')
    number = Column(INTEGER(11), comment='字典编号')
    code = Column(String(50), comment='字典码')
    value = Column(String(50), comment='字典值')
    sort_id = Column(INTEGER(11), comment='排序id')
    is_deleted = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='修改时间')


class DimDay(Base):
    __tablename__ = 'dim_day'

    day_id = Column(String(10), primary_key=True)
    day_ts = Column(BIGINT(20))
    day_short_desc = Column(String(14))
    day_short_desc_oth = Column(String(14))
    day_long_desc = Column(String(100))
    week_id = Column(String(100))
    week_long_desc = Column(String(100))
    month_id = Column(String(100))
    month_short = Column(String(100))
    month_short_desc = Column(String(100))
    month_short_desc_oth = Column(String(100))
    month_long_desc = Column(String(100))
    quarter_id = Column(String(100))
    quarter_long_desc = Column(String(100))
    year_id = Column(String(100))
    year_long_desc = Column(String(100))


class EventDetail(Base):
    __tablename__ = 'event_detail'
    __table_args__ = {'comment': '事件明细'}

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    user_id = Column(BIGINT(20), index=True, comment='用户ID')
    ip = Column(String(100), comment='IP')
    os = Column(String(100), comment='操作系统')
    device_type = Column(TINYINT(4), comment='设备类型(1-移动设备 2-非移动设备)')
    browser = Column(String(100), comment='浏览器')
    source = Column(String(100), comment='来源（PC/H5/Android/IOS）')
    buzz_type = Column(TINYINT(4), comment='事件业务类型（1-藏品 2-作品 3-专题活动）')
    buzz_id = Column(BIGINT(20), index=True, comment='事件业务ID')
    route = Column(String(500), comment='事件页面or接口路由')
    event_time = Column(BIGINT(20), comment='事件产生时间')
    event_type = Column(TINYINT(4), comment='事件类型（1-播放 2-点赞 3-收藏等 ）')


class EventStatisticsDaily(Base):
    __tablename__ = 'event_statistics_daily'
    __table_args__ = (
        Index('event_statistics_daily_UN', 'buzz_type', 'buzz_id', 'create_time', 'event_type', unique=True),
        {'comment': '事件每日统计'}
    )

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    event_type = Column(TINYINT(4), comment='事件类型（1-播放 2-点赞 3-收藏等）')
    buzz_type = Column(TINYINT(4), comment='事件业务类型（1-藏品 2-作品 3-专题活动）')
    buzz_id = Column(BIGINT(20), index=True, comment='事件业务ID')
    uv = Column(INTEGER(11), comment='独立访客')
    pv = Column(INTEGER(11), comment='访问量')
    create_time = Column(BIGINT(20), comment='统计日期')


class ExchangeCode(Base):
    __tablename__ = 'exchange_code'
    __table_args__ = {'comment': '兑换码表'}

    id = Column(BIGINT(22), primary_key=True, comment='主键')
    collection_nft_id = Column(INTEGER(11), nullable=False, comment='收藏品NFT ID')
    collection_nft_type_id = Column(INTEGER(11), comment='收藏品NFT 类型ID')
    exchange_type = Column(TINYINT(4), nullable=False, comment='兑换类型，1-盲盒，2-明盒 3自开盲盒  4 赠送礼品')
    code = Column(String(50), nullable=False, unique=True, comment='兑换码')
    effective_date = Column(INTEGER(22), comment='有效日期')
    create_time = Column(INTEGER(22), comment='创建日期')
    update_time = Column(INTEGER(22), comment='更新时间')
    creator = Column(INTEGER(11), comment='创建人ID')
    state = Column(TINYINT(4), comment='状态 0-未兑换，1-已兑换')
    user_id = Column(INTEGER(11), comment='兑换人ID')
    exchange_time = Column(INTEGER(22), comment='兑换日期')
    code_type = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='1 普通兑换 2 赠送')
    code_key = Column(INTEGER(11), comment='对于code_type=2 赠送类型，关联user_collection_nft_send 主键')
    code_gift = Column(String(50), nullable=False, server_default=text("''"), comment='用于礼品赠送里面的码，当前为兼容设计，礼品赠送只有一个码，原始的code字段必须唯一，导致扩展此字段')


class ExternalAccessLog(Base):
    __tablename__ = 'external_access_log'
    __table_args__ = {'comment': '外部接口访问日志'}

    id = Column(BIGINT(20), primary_key=True)
    method = Column(String(30), nullable=False)
    url = Column(String(250), nullable=False)
    request_message = Column(Text)
    response_message = Column(Text)
    ip = Column(String(64), nullable=False)
    platform_id = Column(String(300))
    trace_id = Column(String(300))
    latency_time = Column(String(100))
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))


class FansBrandGrade(Base):
    __tablename__ = 'fans_brand_grade'
    __table_args__ = {'comment': '粉丝牌等级信息表'}

    id = Column(BIGINT(20), primary_key=True, unique=True, comment='主键')
    level = Column(INTEGER(11), nullable=False, comment='等级')
    background = Column(String(255), comment='粉丝牌背景图')
    grade_integral = Column(BIGINT(20), comment='等级积分')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class FansBrandPointRecord(Base):
    __tablename__ = 'fans_brand_point_record'
    __table_args__ = {'comment': '积分流水表'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True, comment='用户ID')
    fans_group_id = Column(BIGINT(20), nullable=False, comment='粉丝团ID')
    biz_type = Column(INTEGER(11), nullable=False, comment='业务类型（1=持有藏品 2=每日打卡 3=点赞音乐 4=发布圈子 5=发布评论 6=点赞圈子 7=点赞评论）')
    biz_id = Column(BIGINT(20), nullable=False, index=True, comment='业务ID （藏品ID/音乐ID/帖子ID/圈子ID/评论ID）')
    biz_info = Column(String(500), comment='冗余业务信息（藏品名称/音乐名称/帖子内容/圈子标题/评论内容）')
    get_type = Column(TINYINT(1), server_default=text("'0'"), comment='积分获得方式（0=一次性获得 1=每日获得）')
    opt = Column(TINYINT(1), nullable=False, comment='方向（1=增加 2=减少）')
    integral = Column(BIGINT(11), comment='积分数')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    source_id = Column(BIGINT(20), comment='源对象ID（藏品ID/音乐ID）')


class FansBrandUser(Base):
    __tablename__ = 'fans_brand_user'
    __table_args__ = (
        Index('fans_brand_user_user_id_fans_group_id_fans_brand_id_uindex', 'user_id', 'fans_group_id', 'fans_brand_id', unique=True),
        {'comment': '用户粉丝牌记录表'}
    )

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True, comment='用户ID')
    fans_group_id = Column(BIGINT(20), nullable=False, index=True, comment='粉丝团ID')
    fans_brand_id = Column(INTEGER(11), nullable=False, comment='粉丝牌等级ID')
    integral = Column(BIGINT(16), nullable=False, comment='当前积分')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')


class FansGroup(Base):
    __tablename__ = 'fans_group'
    __table_args__ = {'comment': '粉丝团配置表'}

    id = Column(BIGINT(20), primary_key=True, unique=True, comment='主键')
    user_id = Column(BIGINT(20), nullable=False, comment='艺人用户ID')
    fans_brand_name = Column(String(5), comment='粉丝牌名称')
    state = Column(TINYINT(1), server_default=text("'1'"), comment='粉丝团状态（0-禁用 1-启用）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class FansGroupDailyRecord(Base):
    __tablename__ = 'fans_group_daily_record'
    __table_args__ = (
        Index('unique_index', 'user_id', 'fans_group_id', 'date', unique=True),
        {'comment': '粉丝团每日签到'}
    )

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True, comment='用户ID')
    fans_group_id = Column(BIGINT(20), nullable=False, index=True, comment='粉丝团ID')
    date = Column(Date, nullable=False, comment='日期')
    create_time = Column(INTEGER(11))


class FansGroupMission(Base):
    __tablename__ = 'fans_group_mission'
    __table_args__ = {'comment': '粉丝团-任务配置表'}

    id = Column(BIGINT(20), primary_key=True, unique=True, comment='主键')
    fans_group_id = Column(BIGINT(20), nullable=False, index=True, comment='粉丝团ID')
    type = Column(TINYINT(4), nullable=False, comment='任务类型（1=持有藏品 2=每日打卡 3=圈子互动）')
    title = Column(String(255), nullable=False, comment='任务标题')
    desc = Column(String(500), comment='任务描述')
    jump_biz_type = Column(TINYINT(4), comment='调整业务类型（1=活动 2=众投 3=圈子/音乐）')
    jump_type_id = Column(BIGINT(20), index=True, comment='跳转业务ID（活动ID/众投ID/音乐ID）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class FansGroupMissionDetail(Base):
    __tablename__ = 'fans_group_mission_detail'
    __table_args__ = {'comment': '粉丝团任务详情表'}

    id = Column(BIGINT(20), primary_key=True, unique=True, comment='主键')
    mission_id = Column(BIGINT(20), index=True, comment='粉丝团任务ID')
    biz_type = Column(TINYINT(4), comment='业务类型（1=藏品 2=音乐）')
    biz_id = Column(INTEGER(11), index=True, comment='业务ID（藏品ID/音乐ID）')
    grant_type = Column(TINYINT(4), comment='积分发放方式（1=一次性发放 2=每日发放）')
    single_integral = Column(INTEGER(11), comment='单次奖励积分')
    day_integral_limit = Column(INTEGER(11), comment='每日奖励积分上限（-1为不限制）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class InviteStageStatistic(Base):
    __tablename__ = 'invite_stage_statistics'
    __table_args__ = {'comment': '邀请阶段性统计 (用于发阶段性奖励）'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False)
    stage_count = Column(INTEGER(11), nullable=False, comment='阶段数量')
    stage_type = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='阶段类型 1=宫 2=商 3=角 4=徵 （ps羽按排名）')
    create_time = Column(INTEGER(11))


class IosPreviewDeliveryAddres(Base):
    __tablename__ = 'ios_preview_delivery_address'
    __table_args__ = {'comment': 'ios 提审收货地址'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False)
    province = Column(String(50), comment='省')
    city = Column(String(50), comment='市')
    area = Column(String(100), comment='区')
    detail = Column(String(200), comment='详细地址')
    receive_username = Column(String(50), comment='收货人名字')
    receive_phone = Column(String(20), comment='收货人手机')
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))


class IosPreviewOrder(Base):
    __tablename__ = 'ios_preview_order'
    __table_args__ = {'comment': '提审-临时订单表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    order_no = Column(String(50), comment='订单流水号')
    user_id = Column(BIGINT(20), comment='下单用户ID')
    prod_id = Column(BIGINT(20), comment='产品ID')
    addr_id = Column(BIGINT(20), comment='收货地址ID')
    count = Column(INTEGER(11), comment='商品数量')
    total_amount = Column(BIGINT(20), comment='订单总金额')
    pay_type = Column(INTEGER(1), comment='支付方式 1-支付宝 2-微信支付 3-余额支付')
    state = Column(INTEGER(1), comment='订单状态 1:待付款 2:待发货 3:待收货 4:已完成 5:已取消')
    delete_status = Column(INTEGER(1), server_default=text("'0'"), comment='用户订单删除状态，0：未删除， 1：已删除')
    create_time = Column(BIGINT(20), comment='下单时间')
    update_time = Column(BIGINT(20), comment='订单更新时间')
    pay_time = Column(BIGINT(20), comment='付款时间')
    dvy_time = Column(BIGINT(20), comment='发货时间')
    finally_time = Column(BIGINT(20), comment='完成时间')
    cancel_time = Column(BIGINT(20), comment='取消时间')
    dvy_flow_id = Column(String(100), comment='物流单号')
    act_id = Column(BIGINT(20), comment='活动ID')
    history_order_no = Column(String(512), comment='历史单号')
    third_order_no = Column(String(50), comment='第三方订单号')
    version = Column(BIGINT(20), comment='乐观锁')
    unit_price = Column(INTEGER(11), comment='单价')
    order_type = Column(INTEGER(1), comment='订单类型 1-盲盒')


class LoginLog(Base):
    __tablename__ = 'login_log'
    __table_args__ = {'comment': '登录日志'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True)
    phone = Column(String(20))
    ip = Column(String(60), nullable=False)
    platform = Column(String(50), nullable=False)
    channel = Column(String(100))
    version_name = Column(String(50))
    log_type = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='1=登录 2=注册')
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))


class MarketBuy(Base):
    __tablename__ = 'market_buy'

    id = Column(BIGINT(22), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    music_nft_id = Column(INTEGER(11), comment='音乐nft批次id')
    unit_price = Column(INTEGER(11), comment='单价，单位为分')
    count = Column(INTEGER(11), comment='求购数量')
    end_time = Column(INTEGER(11), comment='过期时间（秒）')
    one_percent_price = Column(INTEGER(11), comment='百分之一价格')
    create_time = Column(INTEGER(11), comment='创建时间')
    bought_count = Column(INTEGER(11), comment='已完成数量')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    update_time = Column(INTEGER(11), comment='更新时间')


class MarketOffer(Base):
    __tablename__ = 'market_offer'

    id = Column(BIGINT(22), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    music_nft_batch_id = Column(INTEGER(11), comment='音乐nft批次id')
    unit_price = Column(INTEGER(11), server_default=text("'0'"), comment='单价，单位为分')
    count = Column(INTEGER(11), comment='挂单佘亮')
    traded_count = Column(INTEGER(11), server_default=text("'0'"), comment='成交数量')
    freeze_count = Column(INTEGER(11), server_default=text("'0'"), comment='冻结数量')
    end_time = Column(INTEGER(11), comment='过期时间（秒）')
    one_percent_price = Column(INTEGER(11), server_default=text("'0'"), comment='百分之一价格')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    user_music_nft_id = Column(INTEGER(11), comment='用户音乐nft id')
    offer_type = Column(TINYINT(1), server_default=text("'0'"), comment='挂单类型 1-买单 2-卖单')
    deleted_at = Column(DateTime, comment='删除时间')


class MarketOrder(Base):
    __tablename__ = 'market_order'

    id = Column(INTEGER(11), primary_key=True)
    seller_userid = Column(INTEGER(11), comment='卖家id')
    buyer_userid = Column(INTEGER(11), comment='买家id')
    count = Column(INTEGER(11), comment='数量')
    total_fee = Column(INTEGER(11), comment='总费用（单位为分）')
    create_time = Column(INTEGER(11), comment='创建时间（秒）')
    state = Column(TINYINT(1), comment='状态 0-订单创建（未付款） 1-订单完成 2-订单取消 3-超时取消')
    unit_price = Column(INTEGER(11), comment='单价，单位为分')
    market_offer_id = Column(BIGINT(22), comment='挂单表id')
    order_no = Column(String(32), comment='订单号')
    third_order_no = Column(String(32), comment='第三方订单号')
    pay_type = Column(INTEGER(11), comment='支付方式')
    update_time = Column(INTEGER(11), comment='更新时间')
    version = Column(BIGINT(22), comment='乐观锁')
    order_type = Column(TINYINT(1), comment='订单类型，1-对手未卖单 2-对手未买单')
    music_id = Column(INTEGER(11), comment='音乐ID')
    music_nft_batch_id = Column(INTEGER(11), comment='音乐nft批次id')


class MarketSell(Base):
    __tablename__ = 'market_sell'

    id = Column(BIGINT(22), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    music_nft_id = Column(INTEGER(11), comment='音乐nft批次id')
    unit_price = Column(INTEGER(11), server_default=text("'0'"), comment='单价，单位为分')
    count = Column(INTEGER(11), comment='出售总数量')
    sold_count = Column(INTEGER(11), server_default=text("'0'"), comment='卖出数量')
    freeze_count = Column(INTEGER(11), server_default=text("'0'"), comment='冻结数量')
    end_time = Column(INTEGER(11), comment='过期时间（秒）')
    one_percent_price = Column(INTEGER(11), server_default=text("'0'"), comment='百分之一价格')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    user_music_nft_id = Column(INTEGER(11), comment='用户音乐nft id')


class MessageNotice(Base):
    __tablename__ = 'message_notice'
    __table_args__ = {'comment': '消息通知表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    title = Column(String(100), comment='标题')
    content = Column(Text, comment='内容')
    img = Column(String(500), comment='图')
    img_mobile = Column(String(500), comment='图-移动端')
    type = Column(TINYINT(4), comment='类型（1-文本通知 2-图文通知）')
    state = Column(TINYINT(4), comment='状态（0-禁用 1-启用）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    start_time = Column(BIGINT(20), comment='开始时间')
    end_time = Column(BIGINT(20), comment='结束时间')
    jump_type = Column(TINYINT(4), comment='跳转类型 0-不跳转 1-h5 2-app内部页面')
    link_url = Column(String(500), comment='跳转链接')
    position_id = Column(TINYINT(2), comment='位置（1-PC 2-APP）')


class Mission(Base):
    __tablename__ = 'mission'
    __table_args__ = {'comment': '活动任务'}

    id = Column(BIGINT(20), primary_key=True)
    describe = Column(String(500), comment='活动任务描述')
    part_num = Column(INTEGER(11), comment='参与人数')
    start_time = Column(INTEGER(11), comment='活动任务开始时间')
    end_time = Column(INTEGER(11), comment='活动任务结束时间')
    bonus_title = Column(String(500), comment='奖励标题')
    bonus_desc = Column(String(500), comment='奖励描述')
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))
    lottery_mode = Column(TINYINT(4), server_default=text("'0'"), comment='开奖模式（0-后台开奖 1-用户开奖）')
    rate = Column(INTEGER(11), comment='抽奖概率（注：1%=100， 用户手动开奖模式下使用')
    grant_quantity = Column(INTEGER(11), comment='发放总量')
    title = Column(String(250), comment='任务标题')
    status = Column(TINYINT(4), server_default=text("'0'"), comment='状态（0-禁用 1-启用）')
    limit = Column(INTEGER(11), server_default=text("'1'"), comment='单用户中签上限')
    is_join_group = Column(TINYINT(4), server_default=text("'0'"), comment='是否开启加群验证（0-否 1-是）')
    group_qr_code = Column(String(250), comment='群组二维码')
    learn_more = Column(String(500), comment='了解更多链接')


class MissionAward(Base):
    __tablename__ = 'mission_award'
    __table_args__ = (
        Index('mission_award__idx', 'mission_id', 'user_id'),
        {'comment': '任务奖品'}
    )

    id = Column(BIGINT(20), primary_key=True)
    mission_id = Column(BIGINT(20), nullable=False)
    user_id = Column(BIGINT(20), nullable=False)
    award_type = Column(SMALLINT(6), server_default=text("'1'"), comment='1=提前购买')
    early_purchase_second = Column(INTEGER(11), comment='提前购买时间')
    create_time = Column(INTEGER(11))
    state = Column(SMALLINT(6), server_default=text("'0'"), comment='状态 0=未使用 1=已使用')


class MissionBonu(Base):
    __tablename__ = 'mission_bonus'
    __table_args__ = {'comment': '任务活动奖励'}

    id = Column(BIGINT(20), primary_key=True)
    mission_id = Column(BIGINT(20), nullable=False)
    user_id = Column(BIGINT(20), nullable=False)
    lucky_draw_num = Column(INTEGER(11), comment='抽奖次数')
    create_time = Column(INTEGER(11))


class MissionDailyRecord(Base):
    __tablename__ = 'mission_daily_record'
    __table_args__ = {'comment': '任务签到'}

    id = Column(BIGINT(20), primary_key=True)
    mission_id = Column(BIGINT(20), nullable=False)
    user_id = Column(BIGINT(20), nullable=False)
    signin_day = Column(Date, nullable=False, comment='签到日期')
    create_time = Column(INTEGER(11))


class Music(Base):
    __tablename__ = 'music'
    __table_args__ = (
        Index('fx_index', 'music_name', 'singing', 'describe'),
        {'comment': '音乐信息表'}
    )

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='歌曲所属用户id')
    title = Column(String(50), comment='标题')
    music_name = Column(String(50), comment='歌曲名')
    cover = Column(String(2000), comment='封面')
    cover_dna = Column(String(255), comment='封面dna')
    url = Column(String(255), comment='歌曲路径')
    video_url = Column(String(250), nullable=False, server_default=text("''"), comment='视频url 自我介绍')
    accompaniment_path = Column(String(255), comment='伴奏路径')
    lyric_path = Column(String(255), comment='歌词路径')
    dry_sound = Column(String(255), comment='干音路径')
    copyright = Column(INTEGER(11), comment='版权占比（写入读取做一百处理）')
    recording = Column(String(50), comment='录音')
    original = Column(String(50), comment='原唱者')
    singing = Column(String(50), comment='演唱')
    late = Column(String(50), comment='后期工作人员')
    harmony = Column(String(50), comment='和声者')
    accompany = Column(String(50), comment='伴奏者')
    write_lyrics = Column(String(50), comment='作词者')
    write_music = Column(String(50), comment='作曲者')
    arranger = Column(String(50), comment='编曲者')
    creator = Column(String(50), comment='创作者')
    confusion = Column(String(50), comment='后期混缩')
    original_demo = Column(String(50), comment='母带')
    producer = Column(String(50), comment='制作人')
    production = Column(String(50), comment='监制')
    mix = Column(String(50), comment='混音')
    other_in = Column(String(500), comment='其他参与')
    download_settings = Column(INTEGER(11), comment='下载设置')
    inspiration_description = Column(String(255), comment='灵感说明')
    describe = Column(String(500), comment='作品简介')
    length_time = Column(String(10), comment='时长')
    qqUrl = Column(String(300), comment='QQ链接')
    kugouUrl = Column(String(300), comment='酷狗链接')
    kuwoUrl = Column(String(300), comment='酷我链接')
    wangyiyunUrl = Column(String(300), comment='网易云链接')
    show_count = Column(INTEGER(11), comment='展示总数')
    play_count = Column(INTEGER(11), comment='播放总次数')
    like_count = Column(INTEGER(11), comment='点赞总次数')
    share_count = Column(INTEGER(11), comment='分享转发总次数')
    comment_count = Column(INTEGER(11), comment='评论总数')
    collection_count = Column(INTEGER(11), comment='收藏总数量')
    total_profit = Column(INTEGER(11), comment='总收益')
    apply_state = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='1=待审核 2=审核通过 3=审核不通过')
    type = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='音乐类型（1=歌曲，2=Demo，3=翻唱，4=伴奏）')
    address_id = Column(INTEGER(11), server_default=text("'0'"), comment='地址ID')
    is_casting_nft = Column(INTEGER(11), server_default=text("'0'"), comment='是否铸造nft 0-否 1-是')
    is_top = Column(INTEGER(11), server_default=text("'0'"), comment='是否顶置')
    is_private = Column(INTEGER(11), server_default=text("'0'"), comment='是否私密（仅我可见）')
    is_deleted = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='修改时间')
    metadata_state = Column(TINYINT(1), server_default=text("'0'"), comment='元数据状态 0-默认 1-打包中 2-已打包')
    metadata_hash = Column(String(100), comment='元数据hash')
    erc1155_hash = Column(String(100), comment='erc1155交易hash')
    erc1155_state = Column(TINYINT(1), server_default=text("'0'"), comment='erc1155交易状态 0-默认 1-打包中 2已打包')
    mint_amount = Column(INTEGER(11), server_default=text("'0'"), comment='铸造总量')
    sell_describe = Column(Text, comment='销售描述')
    remainder_proportion = Column(BIGINT(22), comment='剩余可铸造比例')
    act_id = Column(BIGINT(20), server_default=text("'0'"), comment='活动id ')
    is_first_publish = Column(TINYINT(1), server_default=text("'0'"), comment='是否首发 0=不是 1=是')
    limit_state = Column(TINYINT(4), server_default=text("'-1'"), comment='试听限制状态（-1:不限制 0:未购买限制 1:全场限制  2:全场不可播放）')
    creator_desc = Column(Text, comment='创作者说')
    other_platform = Column(String(3000), comment='其他播放平台 json数组')
    audition_audio = Column(String(255), comment='试听音频')
    audition_lyrics = Column(String(255), comment='试听音频歌词')


class MusicComment(Base):
    __tablename__ = 'music_comment'
    __table_args__ = {'comment': '音乐评论表'}

    id = Column(INTEGER(11), primary_key=True)
    music_id = Column(INTEGER(11), index=True, comment='音乐id')
    user_id = Column(INTEGER(11), comment='用户id')
    comment = Column(Text, comment='评论内容')
    like_count = Column(INTEGER(11), comment='点赞数')
    reply_count = Column(INTEGER(11), comment='回复数')
    reply_id = Column(INTEGER(11), server_default=text("'0'"), comment='上级评论的id，为0则是1级评论')
    reply_user_id = Column(INTEGER(11), server_default=text("'0'"), comment='上级评论的用户id')
    is_author_reply = Column(TINYINT(4), server_default=text("'0'"), comment='是否作者回复')
    is_deleted = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    is_top = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='0=未置顶 1=已置顶')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    level = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='几级评论')
    first_reply_id = Column(BIGINT(20), nullable=False, server_default=text("'0'"), comment='所有二三级评论 归到一级评论下 抄抖音')
    is_highlight = Column(TINYINT(4), server_default=text("'0'"), comment='是否高亮（0-否 1-是）')


class MusicEveryday(Base):
    __tablename__ = 'music_everyday'
    __table_args__ = {'comment': '音乐每日展示总数'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    like_count = Column(INTEGER(11), comment='点赞次数')
    comment_count = Column(INTEGER(11), comment='评论次数')
    play_count = Column(INTEGER(11), comment='播放次数')
    fans_play_count = Column(INTEGER(11), comment='粉丝播放次数')
    show_count = Column(INTEGER(11), comment='展示次数')
    fans_show_count = Column(INTEGER(11), comment='粉丝展示次数')
    collection_count = Column(INTEGER(11), comment='收藏次数')
    click_count = Column(INTEGER(11), comment='点击次数')
    share_count = Column(INTEGER(11), comment='转发次数')
    sell_nft = Column(INTEGER(11), comment='出售nft')
    profit = Column(INTEGER(11), comment='收益')
    create_date = Column(Date, comment='创建时间，默认值为当前时间')


class MusicFaq(Base):
    __tablename__ = 'music_faq'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户user_id')
    music_id = Column(INTEGER(11), comment='音乐id')
    question = Column(String(128), comment='问题')
    answers = Column(Text, comment='答案')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')


class MusicLabel(Base):
    __tablename__ = 'music_label'
    __table_args__ = {'comment': '音乐标签表'}

    id = Column(INTEGER(11), primary_key=True)
    music_id = Column(INTEGER(11), comment='音乐id')
    label = Column(String(20), comment='标签')
    type = Column(INTEGER(11), comment='标签类型 1=曲风 2=语言 3=情绪')


class MusicNft(Base):
    __tablename__ = 'music_nft'
    __table_args__ = {'comment': '音乐铸造nft（固定价格）'}

    id = Column(INTEGER(11), primary_key=True, nullable=False)
    title = Column(VARCHAR(100), primary_key=True, nullable=False, comment='标题')
    batch_number = Column(VARCHAR(50), comment='批次号')
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    total_price = Column(BIGINT(22), primary_key=True, nullable=False, comment='总价，单位为分')
    copyright_proportion = Column(BIGINT(22), comment='版权比例（读取写入做一百处理）')
    copyright_year = Column(INTEGER(11), comment='版权时长（单位为年-1为不限期限）')
    casting_count = Column(BIGINT(22), comment='铸造数量')
    unit_price = Column(BIGINT(22), comment='单价，单位为分')
    describe = Column(VARCHAR(500), comment='描述')
    shelf_time = Column(INTEGER(11), comment='上架时间')
    state = Column(INTEGER(11), comment='状态 0-未上架 1-已上架 2-已回收')
    sold_count = Column(INTEGER(11), comment='已售数量')
    type = Column(INTEGER(11), comment='nft类型')
    is_top = Column(INTEGER(11), server_default=text("'0'"), comment='是否顶置')
    is_private = Column(INTEGER(11), server_default=text("'0'"), comment='是否私密（仅我可见）')
    is_delete = Column(TINYINT(1), server_default=text("'0'"), comment='是否删除 0-否 1-是')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    unit_worth = Column(BIGINT(22), comment='单个NFT的价值')
    recycle_count = Column(BIGINT(22), server_default=text("'0'"), comment='已回收的数量')
    recycle_proportion = Column(BIGINT(22), server_default=text("'0'"), comment='已回收比例')


class MusicNftDraft(Base):
    __tablename__ = 'music_nft_draft'
    __table_args__ = {'comment': '音乐铸造nft草稿表'}

    id = Column(INTEGER(11), primary_key=True, nullable=False)
    music_id = Column(INTEGER(11), comment='音乐id')
    arranger = Column(String(50), comment='编曲者')
    confusion = Column(String(20), comment='后期混缩')
    original_demo = Column(String(20), comment='母带')
    producer = Column(String(20), comment='制作人')
    production = Column(String(20), comment='监制')
    mix = Column(String(20), comment='混音')
    other_in = Column(String(500), comment='其他参与')
    harmony = Column(String(20), comment='和声者')
    recording = Column(String(20), comment='录音')
    describe = Column(String(500), comment='作品简介')
    total_price = Column(INTEGER(11), primary_key=True, nullable=False, comment='总价（读取写入做一百处理）')
    copyright_proportion = Column(INTEGER(11), comment='版权比例（读取写入做一百处理）')
    copyright_year = Column(INTEGER(11), comment='版权时长（单位为年-1为不限期限）')
    casting_count = Column(INTEGER(11), comment='铸造数量')
    unit_price = Column(INTEGER(11), comment='单价（读取写入做一百处理）')
    is_shelf = Column(INTEGER(11), comment='是否立即上架')
    nft_describe = Column(String(500), comment='nft描述')
    is_delete = Column(INTEGER(11), comment='是否删除')


class MusicPlatform(Base):
    __tablename__ = 'music_platform'
    __table_args__ = {'comment': '音乐平台'}

    id = Column(BIGINT(20), primary_key=True)
    name = Column(String(100), nullable=False, comment='名称')
    icon = Column(String(500), nullable=False, comment='icon')
    create_time = Column(INTEGER(11), nullable=False)
    update_time = Column(INTEGER(11), nullable=False)


class MusicPost(Base):
    __tablename__ = 'music_post'
    __table_args__ = {'comment': '音乐帖子（圈子）'}

    id = Column(BIGINT(20), primary_key=True)
    music_id = Column(BIGINT(20), nullable=False, index=True, comment='音乐id')
    user_id = Column(BIGINT(20), nullable=False, index=True, comment='用户id')
    content = Column(String(1500), comment='内容')
    pic_url = Column(String(3000), comment='图片多张逗号隔开')
    like_count = Column(INTEGER(11), comment='点赞数')
    reply_count = Column(INTEGER(11), comment='回复数')
    is_owner_post = Column(TINYINT(4), server_default=text("'0'"), comment='是否音乐作者本人的帖子')
    is_top = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='0=未置顶 1=已置顶')
    is_highlight = Column(TINYINT(4), server_default=text("'0'"), comment='是否高亮（0-否 1-是）')
    is_deleted = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    video_url = Column(String(3000), comment='视频地址')
    post_type = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='类型 1=普通圈子 2=官方更新')
    official_change_num = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='官方更新次数')
    title = Column(String(500), comment='标题')


class MusicPostComment(Base):
    __tablename__ = 'music_post_comment'
    __table_args__ = {'comment': '帖子评论'}

    id = Column(INTEGER(11), primary_key=True)
    post_id = Column(INTEGER(11), index=True, comment='帖子id')
    user_id = Column(INTEGER(11), index=True, comment='用户id')
    comment = Column(Text, comment='评论内容')
    like_count = Column(INTEGER(11), comment='点赞数')
    reply_count = Column(INTEGER(11), comment='回复数')
    reply_id = Column(INTEGER(11), server_default=text("'0'"), comment='上级评论的id，为0则是1级评论')
    reply_user_id = Column(INTEGER(11), server_default=text("'0'"), comment='上级评论的用户id')
    is_author_reply = Column(TINYINT(4), server_default=text("'0'"), comment='是否作者回复')
    is_deleted = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    is_top = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='0=未置顶 1=已置顶')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    level = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='几级评论')
    first_reply_id = Column(BIGINT(20), nullable=False, server_default=text("'0'"), comment='所有二三级评论 归到一级评论下 抄抖音')
    is_highlight = Column(TINYINT(4), server_default=text("'0'"), comment='是否高亮（0-否 1-是）')
    is_official = Column(TINYINT(4), server_default=text("'0'"), comment='是否官方回复 1=是 0=否')


class NftChainInfo(Base):
    __tablename__ = 'nft_chain_info'
    __table_args__ = {'comment': '收藏品NFT-区块链关联信息'}

    id = Column(BIGINT(20), primary_key=True)
    nft_id = Column(BIGINT(20), comment='收藏品NFT ID')
    blockchain_id = Column(BIGINT(20), comment='区块链ID')


class NftCompose(Base):
    __tablename__ = 'nft_compose'
    __table_args__ = {'comment': 'NFT 合成配置表'}

    id = Column(BIGINT(20), primary_key=True)
    title = Column(String(500), nullable=False, comment='标题')
    cover = Column(String(500), nullable=False, comment='封面')
    detail_cover = Column(String(500), nullable=False, comment='详情图')
    target_nft = Column(String(1000), nullable=False, comment='json 数组字符 [{"collection_nft_id" 0, "collection_nft_type_id": 0, "rate": 10000}] rate概率 1%=1')
    state = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='1=正常 2=关闭')
    start_time = Column(INTEGER(11), nullable=False, comment='开始时间')
    end_time = Column(INTEGER(11), nullable=False, comment='结束时间')
    completed_num = Column(INTEGER(11), nullable=False, comment='已完成的数量')
    total = Column(INTEGER(11), nullable=False, comment='允许合成的总数量')
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))


class NftComposeMaterial(Base):
    __tablename__ = 'nft_compose_material'
    __table_args__ = {'comment': 'NFT合成材料表'}

    id = Column(BIGINT(20), primary_key=True)
    nft_compose_id = Column(BIGINT(20), nullable=False, index=True, comment='合成表ID')
    collection_nft_id = Column(BIGINT(20), nullable=False)
    collection_nft_type_id = Column(BIGINT(20), nullable=False)
    count = Column(INTEGER(11), nullable=False, comment='需要数量')
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))


class NftComposeRecord(Base):
    __tablename__ = 'nft_compose_record'
    __table_args__ = {'comment': '合成记录'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True)
    nft_compose_id = Column(BIGINT(20), nullable=False, index=True)
    collection_nft_id = Column(BIGINT(20), nullable=False)
    collection_nft_type_id = Column(BIGINT(20), nullable=False)
    token_id = Column(INTEGER(11), nullable=False)
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))


class PayBankBind(Base):
    __tablename__ = 'pay_bank_bind'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(BIGINT(22), nullable=False, comment='用户user_id')
    bank_name = Column(String(64), nullable=False, comment='银行名称')
    bank_code = Column(String(32), nullable=False, comment='银行代码')
    agreeid = Column(String(64), nullable=False, comment='协议编号')
    state = Column(TINYINT(1), server_default=text("'1'"), comment='状态 0-无效 1-有效')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    id_no = Column(CHAR(18), comment='身份证号')
    acc_name = Column(String(20), comment='姓名')
    phone = Column(String(11), comment='手机号')
    acc_no = Column(String(64), comment='银行卡号')


class PayLianlianBankBind(Base):
    __tablename__ = 'pay_lianlian_bank_bind'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(BIGINT(22), nullable=False, comment='用户user_id')
    bank_name = Column(String(64), nullable=False, comment='银行名称')
    bank_code = Column(String(32), nullable=False, comment='银行代码')
    agreeid = Column(String(64), nullable=False, comment='协议编号')
    state = Column(TINYINT(1), server_default=text("'1'"), comment='状态 0-无效 1-有效 2-已解绑 3-解绑中（等待异步回调） 4-绑定中（等待异步回调）')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    id_no = Column(CHAR(18), comment='身份证号')
    acc_name = Column(String(20), comment='姓名')
    phone = Column(String(11), comment='手机号')
    acc_no = Column(String(64), comment='银行卡号')
    order_no = Column(String(32), comment='订单号')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    is_allow_unbind = Column(TINYINT(1), server_default=text("'0'"), comment='是否允许解绑 0-不允许 1-允许')
    unbind_order_no = Column(String(32), comment='解绑卡订单号')


class PayLianlianOpenacct(Base):
    __tablename__ = 'pay_lianlian_openacct'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(BIGINT(22), comment='用户user_id')
    phone = Column(CHAR(11), comment='开户手机号')
    order_no = Column(String(32), comment='订单号')
    acc_name = Column(String(32), comment='用户真实姓名')
    acc_no = Column(String(32), comment='卡号')
    id_type = Column(String(32), comment='证件类型')
    id_no = Column(CHAR(18), comment='身份证号')
    id_exp = Column(CHAR(8), comment='过期时间，格式：yyyyMMdd，长期有效则设置为：99991231')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    state = Column(TINYINT(1), comment='状态 0-无效 1-绑定手机成功 2-开户申请中 3-开户成功 4-销户中 5-已销户 6-开户失败')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    acct_no = Column(String(32), comment='初次绑定的银行卡号')
    acct_phone = Column(CHAR(11), comment='初次绑卡的银行预留手机号')
    cancel_order_no = Column(String(32), comment='销户订单号')
    id_emblem = Column(String(32), comment='身份证正面docid')
    id_portrait = Column(String(32), comment='身份证反面docid')
    modify_order_no = Column(String(32), comment='修改信息订单号')
    modify_state = Column(TINYINT(1), server_default=text("'0'"), comment='修改状态 0-默认 1-修改中 2-修改完成')
    openacct_fail_remark = Column(String(64), comment='开户失败备注')


class PayThirdNotifyLog(Base):
    __tablename__ = 'pay_third_notify_log'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(BIGINT(22), comment='用户user_id')
    order_no = Column(String(32), comment='订单号')
    data = Column(Text, comment='通知数据')
    type = Column(TINYINT(1), comment='类型 1-充值 2-购买盲盒')
    create_time = Column(INTEGER(11), comment='创建时间')


class QuestionBank(Base):
    __tablename__ = 'question_bank'
    __table_args__ = {'comment': '题库表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    title = Column(Text, nullable=False, comment='题目')
    type = Column(TINYINT(4), server_default=text("'1'"), comment='类型（1-单选 2-多选）')
    answer = Column(Text, comment='正确答案（多个答案逗号隔开）')
    state = Column(TINYINT(4), comment='状态（0-禁用 1-启用）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class QuestionOption(Base):
    __tablename__ = 'question_options'
    __table_args__ = {'comment': '题目选项表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    q_id = Column(BIGINT(20), index=True, comment='题目ID')
    value = Column(String(250), comment='选项值')
    state = Column(TINYINT(4), comment='状态（0-禁用 1-启用）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class Rarity(Base):
    __tablename__ = 'rarity'
    __table_args__ = {'comment': 'NFT稀有度信息'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    name = Column(String(100), comment='稀有度名称')
    bg_color = Column(CHAR(8), comment='背景颜色 0x-16进制')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='状态（0-禁用 1-启用）')
    top_color = Column(CHAR(8), comment='顶部颜色')
    bottom_color = Column(CHAR(8), comment='底部颜色')
    background = Column(String(500), comment='背景图')


class Recharge(Base):
    __tablename__ = 'recharge'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), nullable=False, comment='用户userId')
    order_no = Column(String(32), nullable=False, unique=True, server_default=text("''"), comment='订单号')
    amount = Column(INTEGER(11), nullable=False, comment='充值总金额')
    state = Column(TINYINT(1), nullable=False, comment='订单状态 0-已下单 1-已完成 2-已退款')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    update_time = Column(INTEGER(11), nullable=False, comment='更新时间')
    third_order_no = Column(String(64), nullable=False, server_default=text("''"), comment='第三方订单号')
    version = Column(BIGINT(22), nullable=False, comment='乐观锁')
    pay_type = Column(TINYINT(1), nullable=False, server_default=text("'0'"), comment='支付类型 1-支付宝 2-微信')
    quick_pay_ext = Column(Text, comment='快捷支付字段')
    asset_type = Column(TINYINT(1), server_default=text("'1'"), comment='资产账户类型 1-贝多账户 2-连连账户')


class Recommend(Base):
    __tablename__ = 'recommend'
    __table_args__ = (
        Index('recommend__target_biz_uniq', 'target_id', 'biz_type', unique=True),
        {'comment': '推荐'}
    )

    id = Column(BIGINT(20), primary_key=True)
    target_id = Column(BIGINT(20), nullable=False, comment='业务ID')
    biz_type = Column(SMALLINT(6), nullable=False, comment='业务类型 1=音乐 2=活动 3=众投')
    sort = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='排序 越大越前面')
    is_limit = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否长期有效 0=长期有效 1=短期有效')
    start_time = Column(INTEGER(11), comment='开始时间')
    end_time = Column(INTEGER(11), comment='结束时间')
    state = Column(SMALLINT(6), nullable=False, server_default=text("'1'"), comment='状态 1=正常 2=无效')
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))


class SensitiveWord(Base):
    __tablename__ = 'sensitive_word'
    __table_args__ = {'comment': '敏感词'}

    id = Column(BIGINT(20), primary_key=True)
    keyword = Column(String(100), nullable=False, server_default=text("''"))
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    update_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))


class SmsCode(Base):
    __tablename__ = 'sms_code'

    id = Column(INTEGER(11), primary_key=True)
    mobile = Column(String(11), comment='手机号')
    code = Column(String(20), comment='验证码')
    type = Column(INTEGER(11), comment='类型')
    sendtime = Column(INTEGER(11), comment='发送时间')
    verifytime = Column(INTEGER(11), comment='验证时间')
    expiretime = Column(INTEGER(11), comment='过期时间')
    op_count = Column(INTEGER(11))


class SystemNotice(Base):
    __tablename__ = 'system_notice'
    __table_args__ = {'comment': '系统消息表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    title = Column(String(100), comment='标题')
    content = Column(Text, comment='内容')
    type = Column(TINYINT(4), comment='(1=all全体 ，2=appoint 指定)')
    recipient_ids = Column(Text, comment='指定接收通知的用户ID集合')
    link = Column(String(1000), comment='链接')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='是否发布（0-否 1-是）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')
    app_link = Column(String(1000), comment='APP跳转链接')
    h5_link = Column(String(1000), comment='H5链接')


class Tag(Base):
    __tablename__ = 'tags'
    __table_args__ = {'comment': '标签表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    tag_name = Column(String(100), comment='标签名称')
    bg_color = Column(String(100), comment='背景颜色')
    font_color = Column(String(100), comment='字体颜色')
    state = Column(TINYINT(4), comment='状态')


class UserAliTag(Base):
    __tablename__ = 'user_ali_tags'
    __table_args__ = {'comment': '用户阿里标签'}

    user_id = Column(BIGINT(20), primary_key=True)
    register_score = Column(INTEGER(11), nullable=False, server_default=text("'0'"))
    register_tags = Column(String(200), nullable=False, server_default=text("''"))
    client_ip = Column(String(60), nullable=False, server_default=text("''"), comment='客户端IP\\n')
    ip_score = Column(DECIMAL(11, 3), nullable=False, server_default=text("'0.000'"))
    ip_country = Column(String(50), nullable=False, server_default=text("''"))
    ip_province = Column(String(50), nullable=False, server_default=text("''"))
    ip_city = Column(String(50), nullable=False, server_default=text("''"))
    ip_is_idc = Column(TINYINT(4), nullable=False, server_default=text("'0'"))
    ip_is_proxy = Column(TINYINT(4), nullable=False, server_default=text("'0'"))
    ip_is_nat = Column(TINYINT(4), nullable=False, server_default=text("'0'"))
    ip_is_base = Column(TINYINT(4), nullable=False, server_default=text("'0'"))
    device_tags = Column(String(200), nullable=False, server_default=text("''"))
    device_id = Column(String(500), nullable=False, server_default=text("''"))
    create_time = Column(INTEGER(11))
    update_time = Column(INTEGER(11))


class UserAsset(Base):
    __tablename__ = 'user_asset'
    __table_args__ = {'comment': '用户资产表'}

    user_id = Column(INTEGER(11), primary_key=True, comment='用户id')
    sure_amount = Column(INTEGER(11), server_default=text("'0'"), comment='可提现金额，写入和读取时乘以除以1百')
    already_amount = Column(INTEGER(11), server_default=text("'0'"), comment='已提取金额，写入和读取时乘以除以1百')
    balance = Column(INTEGER(11), server_default=text("'0'"), comment='余额（插入和读取做一百处理）')
    frozen_amount = Column(INTEGER(11), server_default=text("'0'"), comment='冻结金额（插入和读取做一百处理）')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    lianlian_balance = Column(INTEGER(11), server_default=text("'0'"), comment='连连余额')
    lianlian_frozen_amount = Column(INTEGER(11), server_default=text("'0'"), comment='连连冻结')
    lianlian_allow_withdraw_amount = Column(INTEGER(11), server_default=text("'0'"), comment='连连可提现金额')


class UserAssetLog(Base):
    __tablename__ = 'user_asset_log'
    __table_args__ = {'comment': '用户资产流水日志'}

    id = Column(BIGINT(22), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户user_id')
    before_amount = Column(BIGINT(22), comment='变更前余额')
    after_amount = Column(BIGINT(22), comment='变更后数量')
    amount = Column(BIGINT(22), comment='变更数量')
    opt = Column(TINYINT(1), comment='方向 1-增加 2-减少')
    biz_type = Column(INTEGER(11), comment='业务类型 查看枚举文件配置')
    create_time = Column(INTEGER(11), comment='创建时间')
    remark = Column(String(512), server_default=text("''"), comment='备注')
    type = Column(TINYINT(1), comment='类型 1-收入 2-支出 3-充值 4-提现')
    asset_type = Column(TINYINT(1), server_default=text("'1'"), comment='资产账户类型 1-贝多账户 2-连连账户')


class UserAward(Base):
    __tablename__ = 'user_award'
    __table_args__ = (
        Index('act_user_idx', 'collection_nft_id', 'user_id'),
        {'comment': '用户奖品'}
    )

    id = Column(BIGINT(20), primary_key=True)
    act_id = Column(BIGINT(20), nullable=False, comment='活动ID')
    collection_nft_id = Column(BIGINT(20), nullable=False, comment='藏品nftID ')
    user_id = Column(BIGINT(20), nullable=False, comment='用户ID')
    type = Column(SMALLINT(6), server_default=text("'1'"), comment='1=提前购买 ')
    state = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='0=未使用 1=已使用')
    early_purchase_second = Column(INTEGER(11), nullable=False, comment='提前购买时间 单位秒')
    expire_time = Column(INTEGER(11), nullable=False, comment='失效时间（即活动开始时间，开始后失效）')
    create_time = Column(INTEGER(11))
    collection_nft_type_id = Column(BIGINT(20), server_default=text("'0'"), comment='NFT类型ID')


class UserBan(Base):
    __tablename__ = 'user_ban'

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False)
    baned_user_id = Column(BIGINT(20), nullable=False, comment='被拉黑用户id ')
    create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"))


class UserBank(Base):
    __tablename__ = 'user_bank'
    __table_args__ = {'comment': '用户银行卡'}

    id = Column(INTEGER(10), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户user_id')
    bank_name = Column(String(100), nullable=False, comment='银行名称')
    bank_address = Column(String(50), comment='银行详细地址')
    realname = Column(String(30), comment='用户姓名')
    bank_card_no = Column(CHAR(22), comment='卡号')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    state = Column(TINYINT(1), server_default=text("'1'"), comment='状态 0-删除 1-有效')


t_user_collection_count = Table(
    'user_collection_count', metadata,
    Column('user_id', INTEGER(11), server_default=text("'0'")),
    Column('collection_nft_id', INTEGER(11)),
    Column('collection_nft_type_id', INTEGER(11), server_default=text("'0'")),
    Column('name', String(32)),
    Column('cnt', BIGINT(21), server_default=text("'0'"))
)


class UserCollectionNft(Base):
    __tablename__ = 'user_collection_nft'
    __table_args__ = {'comment': '用户持有的收藏品nft'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), server_default=text("'0'"), comment='用户user_id')
    token_id = Column(INTEGER(11), server_default=text("'0'"), comment='token_id')
    is_transfer = Column(TINYINT(1), server_default=text("'0'"), comment='是否转出 0-否 1-是')
    create_time = Column(INTEGER(1), server_default=text("'0'"), comment='创建时间')
    update_time = Column(INTEGER(11), server_default=text("'0'"), comment='更新时间')
    source = Column(TINYINT(4), server_default=text("'1'"), comment='来源 1-竞拍 2-即开盲盒 3-空投 4-明盒 5-自开盲盒 6-众投 7自己发布藏品')
    collection_nft_order_no = Column(String(32), server_default=text("'0'"), comment='来源订单号')
    collection_nft_type_id = Column(INTEGER(11), server_default=text("'0'"), comment='收藏品NFT类型ID')
    is_top = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否置顶')
    _from = Column('from', CHAR(42), comment='转出放地址，为空则是初次铸造')
    to = Column(CHAR(42), comment='转入方地址')
    hash = Column(CHAR(100), server_default=text("''"), comment='交易hash')
    state = Column(TINYINT(1), server_default=text("'0'"), comment='状态 0-未铸造 1-铸造中未确认 2-铸造完成 3-提现准备中 4-提现已上链未确认 5-提现已确认')
    collection_nft_id = Column(BIGINT(20), nullable=False, comment='收藏品nft Id ')
    is_private = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否仅我可见')
    is_deleted = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否删除')
    mint_hash = Column(CHAR(100), server_default=text("''"), comment='铸造hash')
    mint_block_height = Column(BIGINT(11), server_default=text("'0'"), comment='铸造时区块高度')
    transfer_block_height = Column(BIGINT(11), server_default=text("'0'"), comment='划转时区块高度')
    lang = Column(TINYINT(1), comment='语言 1-简体中文 2-繁体中文')
    mint_tx_time = Column(INTEGER(11), server_default=text("'0'"), comment='铸造提交时间')
    transfer_tx_time = Column(INTEGER(11), server_default=text("'0'"), comment='划转提交时间')
    act_id = Column(BIGINT(20), comment='来源的活动ID')
    open_transfer_state = Column(SMALLINT(6), server_default=text("'0'"), comment='流转状态 0=可以寄售 1=不可寄售（锁单）')
    metadata_hash = Column(String(100), comment='元数据hash')
    open_lock_receive_phone = Column(String(20), comment='第三锁单时的接受方phone，用于最后成交的检验')
    is_temporary = Column(TINYINT(4), server_default=text("'0'"), comment='是否临时持有（0-否 1-是）注：临时持有藏品不可见')


class UserCollectionNftConfig(Base):
    __tablename__ = 'user_collection_nft_config'
    __table_args__ = {'comment': '开始时间和结束时间的配置'}

    id = Column(INTEGER(11), primary_key=True)
    collection_nft_id = Column(INTEGER(11), nullable=False)
    collection_nft_type_id = Column(INTEGER(11), nullable=False)
    nft_start_time = Column(DateTime, nullable=False, comment='开始时间')
    nft_end_time = Column(DateTime, nullable=False, comment='结束时间')
    create_time = Column(DateTime, nullable=False)


class UserCollectionNftInfo(Base):
    __tablename__ = 'user_collection_nft_info'
    __table_args__ = {'comment': '记录初始化用户发布的藏品时候持有记录，避免多次持有'}

    id = Column(INTEGER(11), primary_key=True)
    uid = Column(INTEGER(11), nullable=False, comment='持有者id')
    create_time = Column(DateTime, nullable=False)
    collection_nft_type_id = Column(INTEGER(11), nullable=False)
    collection_nft_id = Column(INTEGER(11), nullable=False)
    act_id = Column(INTEGER(11), nullable=False)
    num = Column(INTEGER(11), nullable=False, comment='最原始的发布的数量')


class UserCollectionNftLog(Base):
    __tablename__ = 'user_collection_nft_log'
    __table_args__ = {'comment': '收藏品nft log'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20))
    collection_nft_id = Column(BIGINT(20))
    to_user_id = Column(BIGINT(20))
    biz_type = Column(SMALLINT(6), server_default=text("'1'"), comment='1=转赠 2=获赠')
    name = Column(String(100), comment='nft type name')
    works_name = Column(String(100))
    create_time = Column(INTEGER(11))
    token_id = Column(INTEGER(11))
    transfer_channel = Column(SMALLINT(6), server_default=text("'0'"), comment='转让渠道 0=贝多 1=稀石')


class UserCollectionNftSend(Base):
    __tablename__ = 'user_collection_nft_send'
    __table_args__ = {'comment': '赠送汇总表'}

    id = Column(INTEGER(11), primary_key=True)
    from_user_id = Column(INTEGER(11), nullable=False, comment='送出人的用户id')
    collection_nft_id = Column(INTEGER(20), nullable=False)
    collection_nft_type_id = Column(INTEGER(11), nullable=False)
    num = Column(INTEGER(6), nullable=False, comment='转增总数量')
    status = Column(TINYINT(1), nullable=False, comment='1 正常 2下架')
    per_num = Column(INTEGER(6), nullable=False, comment='每人数量')
    create_time = Column(INTEGER(11), nullable=False, comment='创建时间')
    order_no = Column(String(40), nullable=False, unique=True, comment='虚拟的订单编号')
    works_name = Column(String(100), nullable=False)
    send_type = Column(TINYINT(1), nullable=False, comment='赠送类型： 1 站内赠送 2、赠送活动，站外赠送')
    mark = Column(String(255), nullable=False, server_default=text("''"), comment='赠送留言')
    nft_start_time = Column(INTEGER(13), nullable=False, comment='nft 开始时间')
    nft_end_time = Column(INTEGER(13), nullable=False, comment='nft结束时间')
    name = Column(String(100), nullable=False, comment='类型名称')
    code = Column(String(50), comment='赠送活动产生的url，只是针对站外赠送')
    url = Column(String(150), comment='赠送活动产生的码，只是针对站外赠送')


class UserCollectionNftSendDetail(Base):
    __tablename__ = 'user_collection_nft_send_detail'
    __table_args__ = (
        Index('idx_uid_order_no', 'order_no', 'uid', unique=True),
    )

    id = Column(INTEGER(11), primary_key=True)
    order_no = Column(String(40), nullable=False, comment='关联user_collection_nft_send表order_no')
    uid = Column(INTEGER(11), nullable=False, comment='接收人id')
    uname = Column(String(50), nullable=False, comment='接收人name')
    status = Column(TINYINT(1), nullable=False, comment='接收状态： 1 待接收 2 已接收  3、拒绝 4 超时')
    create_time = Column(INTEGER(11))
    receive_time = Column(INTEGER(11))
    num = Column(INTEGER(11), nullable=False, comment='每人数量')


class UserCollectionRecord(Base):
    __tablename__ = 'user_collection_record'
    __table_args__ = {'comment': '用户音乐点赞记录'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    create_time = Column(BIGINT(20), comment='创建时间')
    is_top = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='是否置顶')


class UserDevice(Base):
    __tablename__ = 'user_device'
    __table_args__ = {'comment': '用户设备信息，用于后续评分'}

    user_id = Column(BIGINT(20), primary_key=True)
    ua_token = Column(String(2000), nullable=False, server_default=text("''"))
    wbe_umid_token = Column(String(3000), nullable=False, server_default=text("''"))
    ip = Column(String(50), nullable=False, server_default=text("''"))
    user_agent = Column(String(500), nullable=False, server_default=text("''"))
    refer = Column(String(200), nullable=False, server_default=text("''"))
    operate_source = Column(String(100), nullable=False, server_default=text("''"))
    app_version = Column(String(30), nullable=False, server_default=text("''"))
    device_type = Column(String(30), nullable=False, server_default=text("''"))
    operate_time = Column(INTEGER(11), nullable=False)
    phone = Column(String(30))
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))


class UserEarnPaidRecord(Base):
    __tablename__ = 'user_earn_paid_record'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(BIGINT(22), comment='用户user_id')
    total_amount = Column(BIGINT(22), comment='收益总金额')
    state = Column(INTEGER(11), comment='状态 0-未付款 1-已付款待确认 2-已付款已确认 3-已删除')
    remark = Column(String(512), server_default=text("''"), comment='备注')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    batch_no = Column(String(32), comment='批次号')
    order_no = Column(String(128), comment='订单号')


class UserEnroll(Base):
    __tablename__ = 'user_enroll'
    __table_args__ = {'comment': '用户报名登记表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    user_id = Column(BIGINT(20), index=True, comment='用户ID')
    act_id = Column(BIGINT(20), index=True, comment='目标活动ID')
    ip = Column(String(100), comment='用户请求IP')
    state = Column(TINYINT(4), comment='状态（0-无资格 1-有资格）')
    create_time = Column(BIGINT(20), comment='创建时间')
    update_time = Column(BIGINT(20), comment='更新时间')


class UserEventRemind(Base):
    __tablename__ = 'user_event_remind'
    __table_args__ = {'comment': '用户事件提醒消息表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    action = Column(TINYINT(4), comment='动作（1-点赞 2-回复 3-收藏 4-关注 5-评论 6-高亮 7-置顶）')
    source_id = Column(BIGINT(20), comment='事件源ID')
    source_type = Column(TINYINT(4), comment='事件源类型（1-comment评论 2-works作品 3-user用户 4-posts 帖子）')
    source_content = Column(Text, comment='事件源内容（例如回复的内容、被点赞的评论内容等）')
    uri = Column(String(250), comment='事件发生地点链接')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='是否已读（0-否 1-是）')
    sender_id = Column(BIGINT(20), comment='操作者用户ID')
    recipient_id = Column(BIGINT(20), comment='接收用户ID')
    remind_time = Column(BIGINT(20), comment='事件发生时间')


class UserFollow(Base):
    __tablename__ = 'user_follow'
    __table_args__ = (
        Index('uniq_index', 'user_id', 'follow_id', unique=True),
        {'comment': '用户关注表'}
    )

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    follow_id = Column(INTEGER(11), comment='关注id ')
    create_time = Column(BIGINT(20), comment='创建时间')


class UserInvite(Base):
    __tablename__ = 'user_invite'
    __table_args__ = (
        Index('ui_idx', 'user_id', 'be_invite_id'),
        {'comment': '用户邀请'}
    )

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, comment='用户id')
    be_invite_id = Column(BIGINT(20), nullable=False, comment='被邀请者id')
    from_channel = Column(String(100), comment='来源渠道')
    coupon_num = Column(String(50), comment='优惠券编号')
    create_time = Column(INTEGER(11))
    status = Column(TINYINT(4), server_default=text("'1'"), comment='0=不生效 1=不生效 （邀请券)')


class UserLikesRecord(Base):
    __tablename__ = 'user_likes_record'
    __table_args__ = {'comment': '用户音乐点赞记录'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), index=True, comment='用户id')
    likes_id = Column(INTEGER(11), comment='被点赞的id')
    type = Column(INTEGER(11), comment='类型 1-音乐 2-评论 3-帖子')
    create_time = Column(BIGINT(20), comment='创建时间')
    to_user_id = Column(INTEGER(11), comment='被点赞内容的所有者')


class UserLottery(Base):
    __tablename__ = 'user_lottery'
    __table_args__ = {'comment': '用户奖券表'}

    id = Column(BIGINT(20), primary_key=True, comment='ID')
    user_id = Column(BIGINT(20), index=True, comment='用户ID')
    act_id = Column(BIGINT(20), index=True, comment='活动ID')
    collection_nft_id = Column(BIGINT(20), index=True, comment='收藏品NFT ID')
    collection_nft_type_id = Column(BIGINT(20), comment='收藏品NFT类型ID')
    is_deleted = Column(TINYINT(4), server_default=text("'0'"), comment='是否删除（0-否 1-是）注：删除后前端不展示')
    is_invalid = Column(TINYINT(4), server_default=text("'0'"), comment='是否无效（0-否 1-是）注：无效券前端依旧展示，但无法用于抽奖')
    mission_id = Column(BIGINT(20), index=True, comment='抽签任务ID')
    create_time = Column(BIGINT(20), comment='创建时间')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='状态（0-未使用 1-已使用）')


class UserMsg(Base):
    __tablename__ = 'user_msg'
    __table_args__ = {'comment': '用户消息表'}

    id = Column(INTEGER(11), primary_key=True)
    type = Column(TINYINT(1), comment='类型 1-系统消息')
    title = Column(String(128), comment='标题')
    content = Column(Text, comment='内容')
    create_time = Column(INTEGER(11), comment='创建时间')
    user_id = Column(INTEGER(11), comment='用户id')


class UserMusicAlbum(Base):
    __tablename__ = 'user_music_album'
    __table_args__ = {'comment': '用户音乐专辑表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='专辑所属用户id')
    name = Column(String(50), comment='专辑名称')
    introduce = Column(String(500), comment='专辑介绍')
    remark = Column(String(255), comment='备注')
    is_deleted = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='修改时间')


class UserMusicNft(Base):
    __tablename__ = 'user_music_nft'
    __table_args__ = (
        Index('must_onlyone', 'music_id', 'music_nft_id', 'user_id', unique=True),
        {'comment': '用户已拥有音乐nft表'}
    )

    id = Column(INTEGER(11), primary_key=True)
    music_id = Column(INTEGER(11), comment='音乐id')
    music_nft_id = Column(INTEGER(11), comment='音乐nft批次id')
    user_id = Column(INTEGER(11), comment='持有者id')
    has_date = Column(Date, comment='拥有日期')
    state = Column(TINYINT(11), server_default=text("'0'"), comment='nft状态 0-默认 1-在售')
    hold_count = Column(INTEGER(11), server_default=text("'0'"), comment='持有数量')
    freeze_count = Column(INTEGER(11), server_default=text("'0'"), comment='冻结数量（如果有出售列表，则值>0）')
    version = Column(BIGINT(11), server_default=text("'0'"), comment='乐观锁')
    is_top = Column(TINYINT(1), server_default=text("'0'"), comment='是否置顶 0-否 1-是')
    is_private = Column(TINYINT(1), server_default=text("'0'"), comment='是否私密 0-否 1-是')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    is_deleted = Column(TINYINT(1), nullable=False, server_default=text("'0'"), comment='是否删除 0=正常 1=删除')


class UserMusicNftLog(Base):
    __tablename__ = 'user_music_nft_log'
    __table_args__ = {'comment': '用户资产流水日志'}

    id = Column(BIGINT(22), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户user_id')
    before_amount = Column(BIGINT(22), comment='变更前余额')
    after_amount = Column(BIGINT(22), comment='变更后数量')
    amount = Column(BIGINT(22), comment='变更数量')
    opt = Column(TINYINT(1), comment='方向 1-增加 2-减少')
    biz_type = Column(INTEGER(11), comment='业务类型 查看枚举文件配置')
    create_time = Column(INTEGER(11), comment='创建时间')
    music_id = Column(INTEGER(11), comment='音乐id')
    music_nft_id = Column(INTEGER(11), comment='音乐nft批次id')
    remark = Column(String(32), comment='备注')


class UserMusicOfferPrice(Base):
    __tablename__ = 'user_music_offer_price'
    __table_args__ = {'comment': '用户出价表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    music_id = Column(INTEGER(11), comment='音乐id')
    offer_price = Column(INTEGER(11), comment='出价金额，写入和读取都乘以和除以1百')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='修改时间')


class UserNftMintInfo(Base):
    __tablename__ = 'user_nft_mint_info'
    __table_args__ = (
        Index('user_nft_id_idx', 'user_nft_id', 'type', unique=True),
        {'comment': '用户收藏品铸造信息'}
    )

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    type = Column(TINYINT(1), comment='链类型（1-Polygon 2-蚂蚁链）')
    mint_hash = Column(String(100), comment='铸造hash')
    create_time = Column(INTEGER(32), comment='创建时间')
    update_time = Column(INTEGER(32), comment='更新时间')
    user_nft_id = Column(BIGINT(20), comment='用户持有ID')


class UserNftWithdrawalRecord(Base):
    __tablename__ = 'user_nft_withdrawal_record'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), server_default=text("'0'"), comment='用户user_id')
    token_id = Column(INTEGER(11), server_default=text("'0'"), comment='nft id')
    collection_nft_type_id = Column(INTEGER(11), server_default=text("'0'"), comment='收藏品类型id')
    state = Column(INTEGER(11), server_default=text("'0'"), comment='状态 0-已申请 1-待确认 2-已提现 3-提现失败')
    hash = Column(CHAR(100), comment='交易hash')
    create_time = Column(INTEGER(11), server_default=text("'0'"), comment='创建时间')
    update_time = Column(INTEGER(11), server_default=text("'0'"), comment='更新时间')
    name = Column(String(100), comment='NFT类型名称')
    works_name = Column(String(100), comment='NFT 作品名称')
    to = Column(String(100), comment='用户申请提现地址')


class UserOpenRelation(Base):
    __tablename__ = 'user_open_relation'
    __table_args__ = {'comment': '用户第三方账号表'}

    id = Column(BIGINT(20), primary_key=True)
    user_id = Column(BIGINT(20), nullable=False, index=True)
    rs_phone = Column(String(20), nullable=False, comment='稀石手机')
    state = Column(SMALLINT(6), nullable=False, comment='1=正常 2=取消绑定')
    create_time = Column(INTEGER(11))


class UserPlayList(Base):
    __tablename__ = 'user_play_list'
    __table_args__ = {'comment': '用户音乐播放列表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    song_sheets_id = Column(INTEGER(11), comment='歌单ID，为空则是默认播放列表')
    music_id = Column(INTEGER(11), comment='音乐id')
    is_deleted = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')


class UserRealnameAuth(Base):
    __tablename__ = 'user_realname_auth'
    __table_args__ = {'comment': '用户实名认证记录'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    realname = Column(String(32), comment='姓名')
    card_front = Column(String(255), comment='身份证正面')
    card_back = Column(String(255), comment='身份证反面')
    card_people = Column(String(255), comment='手持身份证')
    effective_start = Column(CHAR(10), comment='有效期开始日期')
    effective_end = Column(CHAR(10), comment='有效期结束日期')
    remark = Column(String(100), comment='备注')
    state = Column(TINYINT(1), server_default=text("'0'"), comment='状态 0-未审核 1-审核成功 2-审核失败')
    create_time = Column(INTEGER(11), comment='创建时间')
    update_time = Column(INTEGER(11), comment='更新时间')
    card_id = Column(CHAR(18), comment='身份证号')
    deleted_at = Column(DateTime)


class UserReport(Base):
    __tablename__ = 'user_report'

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    report_type = Column(TINYINT(1), comment='举报类型，1、色情低俗 2、违法犯罪 3、未成年人相关 4、垃圾广告 5、造谣传谣 6、非原创内容 7、其他')
    content = Column(String(256), comment='举报内容')
    create_time = Column(INTEGER(11), comment='创建时间')
    report_id = Column(INTEGER(11), comment='举报内容id')
    type = Column(TINYINT(4), comment='1、音乐 2、用户 3、评论')
    state = Column(TINYINT(4), comment='0.待处理，1举报成功，2举报失败')


class UserSongSheet(Base):
    __tablename__ = 'user_song_sheet'
    __table_args__ = {'comment': '用户歌单表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    name = Column(String(20), comment='歌单名称')
    is_delete = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')


class UserSongSheetMusic(Base):
    __tablename__ = 'user_song_sheet_music'
    __table_args__ = {'comment': '用户歌单表'}

    id = Column(INTEGER(11), primary_key=True)
    sheet_id = Column(INTEGER(11), comment='歌单id')
    music_id = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    user_id = Column(INTEGER(11), comment='用户id')


class UserSystemNotice(Base):
    __tablename__ = 'user_system_notice'
    __table_args__ = (
        Index('user_system_notice_UN', 'user_id', 'sys_notice_id', unique=True),
        {'comment': '用户系统消息表'}
    )

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    user_id = Column(BIGINT(20), comment='用户ID')
    sys_notice_id = Column(BIGINT(20), comment='系统消息ID')
    sender_id = Column(BIGINT(20), comment='发送方ID')
    state = Column(TINYINT(4), server_default=text("'0'"), comment='是否已读（0-否 1-是）')
    create_time = Column(BIGINT(20), comment='创建时间')


class UserTag(Base):
    __tablename__ = 'user_tags'
    __table_args__ = {'comment': '用户标签表'}

    id = Column(BIGINT(20), primary_key=True, comment='主键')
    user_id = Column(BIGINT(20), index=True, comment='用户ID')
    tag_id = Column(BIGINT(20), index=True, comment='标签ID')


class UserWithdrawalRecord(Base):
    __tablename__ = 'user_withdrawal_record'
    __table_args__ = {'comment': '用户提现申请记录表'}

    id = Column(INTEGER(11), primary_key=True)
    user_id = Column(INTEGER(11), comment='用户id')
    apply_amount = Column(BIGINT(20), comment='申请金额 单位为分')
    state = Column(INTEGER(11), comment='提现状态 0-默认 1-已打款 2-已拒绝 3-打款中，待确认')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='修改时间')
    remark = Column(String(32), comment='拒绝原因')
    real_amount = Column(BIGINT(20), comment='实际到账')
    fee_rate = Column(INTEGER(11), comment='手续费率，比如50.00%:5000')
    fee_total = Column(INTEGER(11), comment='总手续费')
    start_date = Column(Date, comment='结算周期起始日期')
    end_date = Column(Date, comment='结算周期结束日期')
    credentials = Column(Text, comment='打款凭证 图片相对地址')
    admin_id = Column(INTEGER(11), comment='管理员admin_id')
    receive_type = Column(TINYINT(1), comment='收款方式 1-支付宝 2-连连个人银行卡')
    receive_account = Column(String(32), comment='收款账号')
    receive_name = Column(String(32), comment='收款人姓名')
    order_no = Column(String(64), comment='订单号')
    third_order_no = Column(String(64), comment='第三方订单号')
    version = Column(BIGINT(22), server_default=text("'0'"), comment='乐观锁')
    bank_card_id = Column(INTEGER(11), comment='绑定的银行卡id')


class User(Base):
    __tablename__ = 'users'
    __table_args__ = {'comment': '用户信息表'}

    id = Column(BIGINT(20), primary_key=True)
    wx_openid = Column(String(200), comment='微信openid')
    phone = Column(String(11), unique=True, comment='用户手机号')
    user_password = Column(String(50), comment='用户密码')
    nickname = Column(String(50), comment='昵称')
    sex = Column(INTEGER(11), server_default=text("'1'"), comment='性别0女，1男，-1为未设置')
    avatar = Column(String(255), comment='头像路径')
    introduction = Column(String(500), comment='个人介绍')
    douyin_url = Column(String(255))
    kugou_url = Column(String(255))
    qqyinyue_url = Column(String(255))
    wangyiyun_url = Column(String(255))
    weibo_url = Column(String(255))
    kuaishou_url = Column(String(255))
    attention_count = Column(INTEGER(11), comment='关注数')
    fans_count = Column(INTEGER(11), comment='粉丝数')
    likes_count = Column(INTEGER(11), comment='获赞数')
    is_disable = Column(INTEGER(11), server_default=text("'0'"), comment='是否禁用1已禁用0未禁用，默认值为0')
    is_deleted = Column(INTEGER(11), server_default=text("'0'"), comment='是否删除1已删除0未删除，默认值为0')
    create_time = Column(BIGINT(20), comment='创建时间，默认值为当前时间')
    update_time = Column(BIGINT(20), comment='修改时间')
    birthday = Column(Date, comment='生日')
    province = Column(String(255), comment='省份')
    salt = Column(String(50), nullable=False, server_default=text("''"), comment='password + salt')
    invite_code = Column(String(100), comment='邀请码')
    from_channel = Column(String(100), comment='来源渠道')
    setup_password = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='是否设置密码')
    type = Column(TINYINT(1), comment='用户类型 1-常规用户(可发行版权收益NFT) 2-版权方用户(可发行版权收益NFT及收藏品NFT)')
    risk_score = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='阿里注册风险分析分数')
    risk_tags = Column(String(510), nullable=False, server_default=text("''"), comment='阿里注册风险分析tags')
    client_ip = Column(String(100), server_default=text("''"), comment='用户id')
    ua_token = Column(String(2000), server_default=text("''"), comment='js 获取的设备token')
    web_umid_token = Column(String(2000), server_default=text("''"), comment='js 获取的设备相关token')
    act_status = Column(TINYINT(4), server_default=text("'0'"), comment='H5拉新活动用户清洗状态（0-未清洗，1-已清洗）')
    has_nft_transfer = Column(TINYINT(4), nullable=False, server_default=text("'1'"), comment='是否可以转赠 1=可以 0=不可以')
    is_vip_sign = Column(TINYINT(1), server_default=text("'0'"), comment='是否加v 0=否 1=是')
    has_music_publish = Column(TINYINT(1), server_default=text("'0'"), comment='是否有音乐发布权限 0=否 1=有')
    has_music_casting = Column(TINYINT(1), server_default=text("'0'"), comment='是否有铸造权限功能 0=否 1=有')
    delete_time = Column(INTEGER(11), comment='删除时间 即注销时间')
    wx_account = Column(String(500), comment='微信账号')
    device_token = Column(String(256), comment='推送设备号')
    platform = Column(String(50), comment=' 平台（android，ios）')
    privacy_switch = Column(TINYINT(4), server_default=text("'1'"), comment='隐私开关（0-关 1-开）')
    discuz_uid = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='discuz_uid')


class VisitDetail(Base):
    __tablename__ = 'visit_detail'
    __table_args__ = {'comment': '访问明细'}

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    user_id = Column(BIGINT(20), index=True, comment='用户ID')
    ip = Column(String(100), comment='IP')
    os = Column(String(100), comment='操作系统')
    device_type = Column(TINYINT(4), comment='设备类型(1-移动设备 2-非移动设备)')
    browser = Column(String(1000), comment='浏览器')
    source = Column(String(100), comment='来源（PC/H5/Android/IOS）')
    buzz_type = Column(TINYINT(4), comment='访问的业务类型（1-藏品 2-作品 3-专题活动）')
    buzz_id = Column(BIGINT(20), index=True, comment='访问的业务ID')
    route = Column(String(500), comment='访问的页面or接口路由')
    visit_time = Column(BIGINT(20), comment='访问时间')


class VisitStatisticsDaily(Base):
    __tablename__ = 'visit_statistics_daily'
    __table_args__ = (
        Index('visit_statistics_daily_UN', 'buzz_type', 'buzz_id', 'create_time', unique=True),
        {'comment': '访问每日统计'}
    )

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    buzz_type = Column(TINYINT(4), comment='访问的业务类型（1-藏品 2-作品 3-专题活动）')
    buzz_id = Column(BIGINT(20), index=True, comment='访问的业务ID')
    uv = Column(INTEGER(11), comment='独立访客')
    pv = Column(INTEGER(11), comment='访问量')
    create_time = Column(BIGINT(20), comment='统计日期')


class WorksInfo(Base):
    __tablename__ = 'works_info'
    __table_args__ = {'comment': '作品信息'}

    id = Column(BIGINT(20), primary_key=True, comment='唯一标识')
    works_name = Column(String(255), comment='名称')
    desc = Column(Text, comment='描述')
    works_url = Column(String(500), comment='作品文件路径(支持PNG、GIF、WEBP、MP4、MP3)')
    creator_user_id = Column(BIGINT(20), comment='创作者用户ID')
    works_attribute = Column(JSON, comment='作品属性')
    update_time = Column(BIGINT(20), comment='更新时间')
    create_time = Column(BIGINT(20), comment='创建时间')
    type = Column(BIGINT(20), comment='类型 1-头像 2-音频')
    contract_agreement = Column(TINYINT(4), comment='合约标准 1：ERC721 2：ERC1155')
    cover = Column(String(500), comment='封面')
    metadata_ = Column('metadata', JSON, comment='元数据')
    external_url = Column(String(500), comment='外部链接')
